Need to dynamically register broadcast receiver for ConnectivityManager.CONNECTIVITY_ACTION broadcast on API >= 24
ClosedPublic

Authored by eduisters on Nov 7 2018, 4:09 PM.

Details

Summary

On android versions >= 24 manifest registered broadcast receivers for ConnectivityManager.CONNECTIVITY_ACTION
will not receive the broadcast, see: https://developer.android.com/reference/android/net/ConnectivityManager#CONNECTIVITY_ACTION

Test Plan

Run app on phone with API > 24 without this patch and this broadcast will not be received any longer
Run app on phone with API > 24 with this patch and this broadcast will be received again

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
eduisters created this revision.Nov 7 2018, 4:09 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptNov 7 2018, 4:09 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
eduisters requested review of this revision.Nov 7 2018, 4:09 PM
albertvaka accepted this revision.Nov 7 2018, 5:07 PM
albertvaka added a subscriber: albertvaka.

LGTM.

Although, documentation says:
This constant was deprecated in API level 28. Apps should use the more versatile requestNetwork(NetworkRequest, PendingIntent), registerNetworkCallback(NetworkRequest, PendingIntent) or registerDefaultNetworkCallback(ConnectivityManager.NetworkCallback)

This revision is now accepted and ready to land.Nov 7 2018, 5:07 PM
This revision was automatically updated to reflect the committed changes.