Code example for WakefulBroadcastReceiver

Methods: startWakefulService, setResultCode

0
        // Explicitly specify that GcmIntentService will handle the intent. 
        ComponentName receiveIntentLauncherComponent =
                new ComponentName("com.plasync.client.android.gcm",
                                  GcmReceiveIntentLauncher.class.getName());
        // Start the service, keeping the device awake while it is launching. 
        startWakefulService(context, (intent.setComponent(receiveIntentLauncherComponent)));
        setResultCode(Activity.RESULT_OK);
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java