Description
Connectivity.ConnectivityChanged handler does not work when targeting API 34 on Android 14 phones / emulators.
Other combinations of API levels and Android versions seem to work.
This is the same bug already reported and fixed in Maui: Adding a Connectivity.ConnectivityChanged handler does not work on Android 14 #19949.
Code snippet
Adding the handler
Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
Do not call the method:
private async void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
{
Console.WriteLine("Connectivity changed");
}
Steps to Reproduce
Download and deploy the reproduction repo.
Target API 33 or run it on an Android 13 emulator. When you make changes on the connectivity (switch flight mode on and off), the line 'connectivity changed' appears on the console (expected behavior).
When compiling for API 34 and running in an Android 14 emulator, nothing appears on console (Connectivity_ConnectivityChanged is never reached).
Reproduction Link
Reproduction repo.