My project shows error message that WakefulBroadcastReceiver cannot be resolved to a type
.
I looked up for all possible reasons I can think of. I have set android-support-library
and google play services
's path. Even my mapView works (if I comment below code) that means google play service
is correctly added to project.
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
// Start the service, keeping the device awake while it is launching.
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
Any idea why this gives error?