broadcastreceiver - Android O monitoring network changes -


what recommended way monitor connects , disconnects , wifi networks?

ordinarily, register broadcastreceiver in manifest , listen state changes.

android o going make impossible:

apps cannot use manifests register implicit broadcasts (that is, broadcasts not targeted @ app).

what next best (least battery consuming) way accomplish same task?

my initial assessment create service monitor network state changes. don't idea of running permanent service purpose alone.

option 1: can register broadcastreceiver in java code, instance, in activity's onstart() , unregister in onstop(). works when activity alive, of course.

option 2: use jobscheduler. can schedule jobs based on available criteria in jobscheduler network connection availability.

my initial assessment create service monitor network state changes. don't idea of running permanent service purpose alone.

even not simple. service killed if system finds idle. if don't want service killed, have start foreground service, catch requires notification shown user.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -