connectivity plugin

2»

Posts

  • AnantDabhiAnantDabhi INMember

    @JamesMontemagno I tried only "goolge.com" as you suggested..
    still getting false everytime in both IsReachable and IsRemoteReachable calls.

  • BasavaPBasavaP USMember
    edited July 2016

    Hi,

    How can I check, is Cellular data connected or not?, using Xam.Plugin.Connectivity plugin in PCL project.

  • TonyCaseyTonyCasey IEMember ✭✭

    Same for me, I can't for the life of me get it to connect to the local IIS.

    HttpClient works fine and can see the local API using the IP address but Plugin.Connectivity.CrossConnectivity.Current.IsReachable just keeps coming back false.

    Visual Studio 2015 & Genymotion emulator

  • SagarPanwalaSagarPanwala USMember ✭✭

    @JamesMontemagno I tried only "goolge.com" as you suggested..
    still getting false everytime in both IsReachable and IsRemoteReachable calls.

    Is there any update on this?

  • is possible get wifi name from network with this plugin ?
    Thanks

  • AquablueAquablue USMember ✭✭

    Hello,

    We are developing a Xamarin.Forms application and using..

    var result = await CrossConnectivity.Current.IsRemoteReachable("http://www.google.com")

    .. to check if we have a working internet connection.
    Everything works as expected, i.e. we get back true from the IsRemoteReachable method, on real (Android, iOS and Windows Phone) devices and on VS emulators for Android and iOS emulators.
    The problem is that with the Windows Phone 10 emulators (Mobile Emulator 10.0.14393.0) we get false even if the device is connected (for instance, we can access our backend from our client if we skip the check above or browse internet via Edge).

    Did someone successfully used the IsRemoteReachable on Windows Phone 10 emulators (by deploying a Universal Window App on the emulator)?
    @JamesMontemagno: did you tested if IsRemoteReachable works for Windows Phone 10 emulators?

    Any help is welcome :smile:

  • adamsowadamsow PLMember

    Hi,
    Any update on this?
    IsRemoteReachable works in debug on android emulator but not on real device.
    bool isAPIReachable = await CrossConnectivity.Current.IsRemoteReachable("google.com"); if (!isAPIReachable) { await DisplayAlert(AppResources.APINotReachableTitle, AppResources.APINotReachableMessage, "OK"); }

    isAPIReachable is always false on real android device.

    Xam.Plugin.Connectivity version - 2.3.0

  • AMORFAIROUZAMORFAIROUZ USMember ✭✭

    hello everone i'm doing this function in the app.xaml.cs

    private void CheckConnectivity()
    {
    var isConnected = CrossConnectivity.Current.IsConnected;
    var connected = new Label
    {
    Text = "not Connected: "
    };

            if (isConnected == true)
            {
                MainPage = new Pages.LoginPage();
            }
           else if(isConnected==false)
            {
    
                MainPage = page = new ContentPage
                {
                    Content = new StackLayout
                    {
                        Padding = 50,
                        VerticalOptions = LayoutOptions.Center,
                        Children =
                    {
    
                          connected,
    
                    }
                    }
                };
            }
    
        }
    

    and it doesn't work for me any help ?(plugin installed and the sample of @jamesmontemagno is working) wht i need is redirection
    thks for help

  • hattedbeyhattedbey USMember

    I got the same problem. Finally I found out that I only added the Xam.Plugin.Connectivity in PCL but I didn't add the package in the Android folder too. You add the package in Android folder again and it should works.

  • public App()
    {

    #if ANDROID
                platform = "Android";
    #endif
    #if IOS
                platform = "IOS";
    #endif
    
    
    
    var networkStatus = CrossConnectivity.Current.IsConnected ? "Connected" : "No Connection";
         if (networkStatus == "Connected") {
    
    
    //here i am getting issue . app freezes here and crashing
            var reachable =await CrossConnectivity.Current.IsReachable("http://google.com");
    
            if (reachable == true) {
        mainpage = new NavigationPage(new homepage());
    
            }else{
    
        mainpage = new NavigationPage(new Errorpage());
    }
    
    
        }
    
  • I can't call await method above its getting me an error now what I can do is I removes await and use
    var reachable = CrossConnectivity.Current.IsReachable("http://google.com").Result;
    but here also app freezes....
    need help what to do

  • Eric.ReevesEric.Reeves USMember ✭✭

    Hello,

    I am having an issue with the plugin. It works great on iOS but on android I am getting a System.NotImplementedException.

    I have checked my permissions and all projects have the same version of the connectivity plugin nuget package installed.

        public bool DoIHaveInternet()
        {
            return CrossConnectivity.Current.IsConnected;
        }
    
    
    [MonoDroid] UNHANDLED EXCEPTION:
    [MonoDroid] System.NotImplementedException: This functionality is not implemented in the portable version of this assembly.  You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
    [MonoDroid]   at Plugin.Connectivity.CrossConnectivity.get_Current () [0x0000d] in C:\projects\connectivityplugin\src\Connectivity.Plugin\CrossConnectivity.cs:28 
    [MonoDroid]   at RestfulAPI.DoIHaveInternet () [0x00001] in /Models/RestfulAPI.cs:131 
    [MonoDroid]   at view.SplashPage.OnAppearing () [0x0001e] in /view/SplashPage.xaml.cs:45 
    [MonoDroid]   at Xamarin.Forms.Page.SendAppearing () [0x00024] in C:\agent\_work\3\s\Xamarin.Forms.Core\Page.cs:307 
    [MonoDroid]   at Xamarin.Forms.Platform.Android.PageRenderer.OnAttachedToWindow () [0x00027] in C:\agent\_work\3\s\Xamarin.Forms.Platform.Android\Renderers\PageRenderer.cs:31 
    [MonoDroid]   at Android.Views.View.n_OnAttachedToWindow (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/src/Mono.Android/obj/Release/android-26/mcw/Android.Views.View.cs:15187 
    [MonoDroid]   at (wrapper dynamic-method) System.Object:a07728ed-e095-475e-b53e-f51ab7bb58e9 (intptr,intptr)
    

    Any idea why this function is throwing an exception? I thought this plugin was cross platform. I feel like I should not need a custom render in the android project to access its functionality. Any help would be awesome. Thanks!

  • MoniBhMoniBh USMember ✭✭

    @DavidRiha I am trying your solution to get it work in Xamarin Forms Ios and android both, but I am getting the below error

    The type 'IJavaPeerable' is defined in an assembly that is not referenced. You must add a reference to assembly 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.

    I am trying to do it using dependency. Please let me know if I am doing anything wrong.

  • MoniBhMoniBh USMember ✭✭

    @DavidRiha Same I implemented in Android but there also it is getting freezed and not returning remote network status

2»
Sign In or Register to comment.