I want to perform certain network actions when a specific wifi network is connected, and this has to be done automatically without user input even since boot time. There is also a Preference
that tells me whether or not these actions are performed automatically.
As far as I have understood, applications need the special permission named RECEIVE_BOOT_COMPLETED
to perform certain actions at boot time (including initializing the application itself), and those are implemented in the code via a BroadcastReceiver
.
In order to save battery avoiding polling for wifi state, I can register a BroadcastReceiver
for the ConnectivityManager.CONNECTIVITY_ACTION
and query it for the wifi network's name.
Can the CONNECTIVITY_ACTION
listener, or just any other listener, be declared from AndroidManifest.xml
and be triggered without application start, just like making boot receiver useless?