相关疑难解决方法(0)

WakefulBroadcastReceiver无法解析为某种类型

我的项目显示错误消息WakefulBroadcastReceiver cannot be resolved to a type.我抬头看看我能想到的所有可能的原因.我已android-support-librarygoogle 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);
    }
}
Run Code Online (Sandbox Code Playgroud)

知道为什么会出错吗?

java android

18
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

java ×1