Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

Connectivity = NONE only works on IOS but not Android #656

@rpascalegh

Description

@rpascalegh

Bug report best practices: Submitting Issues

Description

Using Essentials connectivity to show connection status. When there is no connection, Android device shows Local or internet, but not NONE. When there is no connection Android shows LOCAL instead of NONE.. On IOS it works correctly, device shows NONE as expected.

Steps to Reproduce

In code behind put in simple code for testing and 2 labels in Xaml to display changes.

public MainPage()
{
    InitializeComponent();
    Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
}

private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
{
    LabelStatus.Text = "NetworkAccess : " + e.NetworkAccess + "Profile: " + e.ConnectionProfiles;
    UpdateLabels();
    //throw new NotImplementedException();
}

        private void UpdateLabels()
        {
   
            var current = Connectivity.NetworkAccess;
            if (current == NetworkAccess.Internet)
            {
                LabelConnect.Text = "Internet";
            }
            else if (current == NetworkAccess.None)
            {
                LabelConnect.Text = "NONE";
            }
            else if (current == NetworkAccess.Local)
            {
                LabelConnect.Text = "local";
            }

        }
        protected override void OnAppearing()
        {
            UpdateLabels();
        }

In XAML just added to labels

    <StackLayout>
    
        <Label Text="Welcome to Xamarin.Forms!" x:Name="LabelStatus"></Label>
        <Label Text="Current connection:" x:Name="LabelConnect"></Label>

    </StackLayout>
  1. Run app
  2. Shows Wifi or Local correctly
  3. Turn on airplane mode to disable wifi and cell

Expected Behavior

To display NONE (IOS displays NONE)

Actual Behavior

NetworkAccess : LocalProfile
Label update shows Local (current == NetworkAccess.Local)

Basic Information

  • Version with issue: Xamarin Essentials Version 1.0.0 /Xamarin Forms 3.1.0.697729
  • Last known good version: never tested, new.
  • IDE:
  • Platform Target Frameworks: Tried 8.0(oreo) and 9.0(P)
    • iOS:
    • Android: 8.1OREO
  • Android Support Library Version:
  • Nuget Packages:Xamarin Essentials Version 1.0.0 /Xamarin Forms 3.1.0.697729
  • Affected Devices: Android
    Testing on Galaxy S9+ running Android 8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions