请帮我解决这个问题。手机只有在设备开机时才会收到消息。当它通过按下电源按钮关闭大约(20-30)秒时,它会停止接收并在它打开时继续接收。这是我的接收器。
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("GCM ", "GCM COME");
ComponentName comp = new ComponentName(context.getPackageName(),
MainService.class.getName());
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}