Skip to content Skip to sidebar Skip to footer

Connectivity Change Broadcast Receiver Not Triggering When Phone Is In Sleep Mode

I have a network state change Broadcast Receiver setup for my app. I need to receive wifi connect-disconnect events even when phone is in sleep mode. This works when phone is charg

Solution 1:

Use a WakefulBroadcastReceiver:

Helper for the common pattern of implementing a BroadcastReceiver that receives a device wakeup event and then passes the work off to a Service, while ensuring that the device does not go back to sleep during the transition.

This class takes care of creating and managing a partial wake lock for you; you must request the WAKE_LOCK permission to use it.

Post a Comment for "Connectivity Change Broadcast Receiver Not Triggering When Phone Is In Sleep Mode"