即使在應用程序被終止後(不在後臺中),任何人都可以幫助我接收小米和聯想設備上的通知嗎?一旦應用程序在Android中的小米和聯想設備上遇害,則不會收到GCM通知
編輯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>
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);
}
}
它解決MI設備上而不是在聯想的設備我的問題。
感謝
嗨。你見過這個[post](http://stackoverflow.com/q/39504805/4625829)的答案嗎? –
[Android應用程序在多任務托盤停止時未收到Firebase通知]的可能重複(http://stackoverflow.com/questions/39504805/android-app-not-receiving-firebase-notification-when-app-是停止從多t) –
@AL是的,我做了,但它不是我在找什麼。 –