gotev / android-host-monitor

Easily monitor device network state and remote hosts reachability on Android
http://gotev.github.io/android-host-monitor/
Apache License 2.0
75 stars 24 forks source link

Scope #7

Closed garudaonekh closed 8 years ago

garudaonekh commented 8 years ago

Hi, If I I use initialize the monitor in an activity using broadcastreceiver( init in manifest), will the broadcast be still fired when the activity is destroyed?

And what if I use Application as context?

Thanks;

gotev commented 8 years ago

will the broadcast be still fired when the activity is destroyed?

no, as per Android activity lifecycle

And what if I use Application as context?

In that case you should not do that and implement it as a global broadcast receiver and register it in your manifest

garudaonekh commented 8 years ago

Why I should not use Application as context?

gotev commented 8 years ago

Because if you need the application context it means you need a global broadcast receiver