Android上的小米和联想设备上的应用程序被杀后,未收到GCM通知

Sap*_*rma 5 notifications android google-cloud-messaging

任何人都可以帮助我接收有关小米和联想设备的通知,即使应用程序被杀后(不再在后台)?

编辑1

我添加了GCM广播接收器.这是代码

在AndroidManifest.xml中

 <receiver
       android:name="com.don.offers.broadcast_receiver.GcmBroadcastReceiver"
       android:permission="com.google.android.c2dm.permission.SEND" >
       <intent-filter>
           <!-- Receives the actual messages. -->
           <action android:name="com.google.android.c2dm.intent.RECEIVE" />
           <category android:name="com.google.android.gcm.demo.app" />
       </intent-filter>
   </receiver>
Run Code Online (Sandbox Code Playgroud)

GcmBroadcastReceiver.java

public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        ComponentName comp = new ComponentName(context.getPackageName(),
                RegistrationIntentService.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)

它解决了我在MI设备上的问题,但没有在联想设备上解决.

谢谢