-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Update documentation for connectivity #2328
Conversation
@mehmetf is this also true for Flutter isolates running in foreground services? (I think the answer may be in my question already :)). If so, should we mention that as well? |
@cyanglaz Please take a look at this PR. |
@ened What do you mean by "this"? The connectivity plugin native code is not running in a foreground service. To be clear, this issue does not arise because the isolate is killed. In this case, the isolate is alive and running, however the background service that delivers connectivity updates no longer does so post Android O. |
Apologies for not being clear. I was wondering if an isolate+plugin owned by an Android foreground service would still be able to receive connectivity updates, essentially whether the BroadcastReceiver in the plugin fires. |
@ened Thanks for clarifying. At its current state,
Perhaps you are proposing to change the way the plugin is written to register itself in a foreground service? and wondering whether any plugin using a broadcast receiver can work around this by registering itself in a foreground service? I would advise against that because every foreground service needs to have a sticky notification as long as it is running. Foreground services are reserved for actual critical work such as playing music. It is actually pretty rare that your app would need a foreground service. Android strongly encourages you to use background services or work manager jobs to do work. You should not be registering a foreground service just to listen to network changes. |
Note that (per @amirh) we prefer to do CHANGELOG entries and pubspec.yaml updates even for purely documentation-specific updates. |
…flutter/has_gesture * commit 'be71485431cd5ebaeb7cad4c57ddeb0be910d8b6': (74 commits) [webview_flutter] Add support for onPageStarted event (flutter#2295) adds missing [[ to elif statement in scripts/incremental_build.sh (flutter#2358) [none] Pass --custom-analysis flag through CI (flutter#2356) [video_player] Document public API of video_player_platform_interface. (flutter#2355) [none] Lock pedantic version (flutter#2354) [video_player_platform_interface] Fix some pedantic lints (flutter#2349) Export SignInOption from interface since it is used in the frontend (flutter#2350) Update documentation for connectivity (flutter#2328) [ android_alarm_manager ] Loosen Flutter SDK lower bound, update README (flutter#2338) [e2e_macos] Remove redundant analysis_options.yaml (flutter#2347) Revert "[android_alarm_manager] Update minimum Flutter version to 1.12.0 (flutter#2327)" (flutter#2345) [video_player] Add web implementation using platform interface (flutter#2279) [webview_flutter] Fix pedantic lint errors (flutter#2322) [google_maps_flutter] Add documentation (flutter#2303) [e2e] Fix pedantic lints (flutter#2315) [video_player] Fix pedantic lints (flutter#2321) [share] Fix pedantic lints (flutter#2320) [battery] Fix pedantic linter errors (flutter#2311) [device_info] Fix pedantic errors (flutter#2314) [in_app_purchase] Fix most failing pedantic lints (flutter#2317) ... # Conflicts: # packages/webview_flutter/CHANGELOG.md # packages/webview_flutter/lib/platform_interface.dart # packages/webview_flutter/lib/webview_flutter.dart # packages/webview_flutter/pubspec.yaml
We recently discovered that connectivity broadcasts no longer work in the background post Android O (API 26). In the long term Android wants to crack down on apps that awaken unnecessarily.
Apps should update their knowledge of connectivity when they are resumed if they are storing it. The plugin itself does not store current connectivity so the Dart API is not the appropriate place to do this.