Home > DeveloperSection > Forums > Wake lock required for BroadcastReceiver phone sleeps?
sandy taylor
sandy taylor

Total Post:46

Posted on    November-18-2014 10:36 PM

 Android Android sdk 

 1 Reply(s)
 1034  View(s)
Rate this:
Trying to write a Broadcast Receiver that processes incoming SMSs. Do I need to use a wake lock / partial wake lock, for this application to work, in spite of device going to sleep due to lack of foreground activity ?

Maria Susan

Total Post:29

Posted on    November-19-2014 12:16 AM

I tend to extend a WakefulBroadcastReceiver to simplify things, so in a way yes. For example:

public class MyBroadcastReceiver extends WakefulBroadcastReceiver {


    public void onReceive(Context context, Intent intent) {

        final ComponentName comp = new ComponentName(context.getPackageName(),


        // Start the service, keeping the device awake while it is launching.

        startWakefulService(context, (intent.setComponent(comp)));




Don't want to miss updates? Please click the below button!

Follow MindStick