I tested that registering ConnectivityManager.CONNECTIVITY_ACTION
("android.net.conn.CONNECTIVITY_CHANGE")
sends sticky Intent
. Can we be sure that we receive this sticky Intent on all devices and os versions? And will it be available in the future release of android os?
Asked
Active
Viewed 215 times
1

AppiDevo
- 3,195
- 3
- 33
- 51
-
If you mean using a broadcast receiver to receive this intent, no it won't work on android 8+ for apps using targetSdk >= 24 – Akram Feb 17 '18 at 11:58
-
@Merka Any link to this? – AppiDevo Feb 17 '18 at 12:00
-
it is explained here: https://developer.android.com/topic/performance/background-optimization.html – Akram Feb 17 '18 at 12:03
-
@Merka I was taking about STICKY Intent, not about registering receiver. Btw ConnectivityManager.CONNECTIVITY_ACTION still works on api 24 and higher. "Note: A BroadcastReceiver registered with Context.registerReceiver() continues to receive these broadcasts while the app is running." – AppiDevo Feb 17 '18 at 12:08
-
I didn't understand your case and still I am not sure what it is. But if this explanation in above link doesn't affect your usecase and you don't need it to work when app is not in foreground, I think you won't have problem. Also I don't know if it will be available in future release of android or not and I don't think anyone can predict it :D – Akram Feb 17 '18 at 12:11
-
The author is asking if the intent is guaranteed to be sticky on future Android version. This is relevant because the documentation does not state that the intent is sticky. – Jeffrey Blattman Aug 24 '21 at 20:12