vpnhood / VpnHood

Undetectable Fast Portable VPN
GNU Lesser General Public License v2.1
1.01k stars 152 forks source link

Maui Error #471

Closed SalimiHabib closed 9 months ago

SalimiHabib commented 9 months ago

hi in MAUI i try to use vpnhood in android platform but i get error on AndroidDevicewhen i try to Device.Prepare(this );

        private static readonly AndroidDevice Device = new();
        private VpnHoodClient? _vpnHoodClient;

    protected override void OnCreate(
Bundle bSavedInstanceState)
    {
        try
        {
            base.OnCreate(bSavedInstanceState);
            Device.Prepare(this  );
}}

Severity    Code    Description Project File    Line    Suppression State
Error   CS0311  The type 'Android.App.Activity' cannot be used as type parameter 'T' in the generic type or method 'AndroidDevice.Prepare<T>(T)'. There is no implicit reference conversion from 'Android.App.Activity' to 'VpnHood.Client.Device.Droid.Utils.IActivityEvent'.  aco.vpn.maui (net8.0-android)   C:\Users\aaffddss\source\repos\Platforms\Android\MainActivity.cs    29  Active

thank you

trudyhood commented 9 months ago

Can I see your repo?

However, you use the old nuget; Your MainActitivity should inherit from ActivityEvent. Also I see you are using VpnHoodClient, it is for lowest level connection, if you are going to create a VPN app, I recommend you use VpnHood.Client.App that does a lot of jobs.