Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

I've a problem with Xam.Plugin.connectivity

$
0
0

Hello,

I've a problem with the plugin Connectivity. When I start my app I've this mistake :

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.

On this line :

CrossConnectivity.Current.ConnectivityChanged += Current_ConnectivityChanged;

This is my code :

using Xamarin.Forms;
using Plugin.Connectivity;

namespace CMore
{
    public partial class CMorePage : ContentPage
    {
        public CMorePage()
        {
            InitializeComponent();

            CrossConnectivity.Current.ConnectivityChanged += Current_ConnectivityChanged;
        }

        private async void Current_ConnectivityChanged(object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e)
        {
            if (!e.IsConnected)
            {
                await DisplayAlert("Erreur", "Vérifier votre connexion internet!", "OK");
            }
            else
            {
                loadingData.IsRunning = false;
                loadingData.IsVisible = false;
                await Navigation.PushAsync(new MapPage());
            }
        }

        protected async override void OnAppearing()
        {
            base.OnAppearing();
            if (!CrossConnectivity.Current.IsConnected)
            {
                await DisplayAlert("Erreur", "Vérifier votre connexion internet!", "OK");
            }
        }
    }
}

Please help me

Thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>