简体   繁体   中英

Check Internet connection reachability in xamarin forms

I am using https://github.com/jamesmontemagno/ConnectivityPlugin plugin to check inte.net connection reachability in my xamarin.forms mobile application. But it's taking some time to load. Is there any way to reduce the loading time?

       if (CrossConnectivity.Current.IsConnected)
       {
           if (await CrossConnectivity.Current.IsRemoteReachable(new Uri("https://www.google.lk/").Authority))
           {
               //do some thing
           }
           else
           {
              //connection is not reachable
           }
       }

Refer the step 2 of the following blog : How to check network status from Xamarin.Forms app? https://bsubramanyamraju.blogspot.in/2017/04/xamarinforms-consuming-rest-webserivce_17.html

Try using Xamarin Essentials Connectivity:

https://learn.microsoft.com/en-us/xamarin/essentials/connectivity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM