我的项目显示错误消息WakefulBroadcastReceiver cannot be resolved to a type
。我查找了我能想到的所有可能的原因。我已经设置了android-support-library
andgoogle play services
的路径。甚至我的 mapView 也有效(如果我在代码下方评论),这意味着google play service
已正确添加到项目中。
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);
}
}
知道为什么这会出错吗?