我用onesignal向我的應用程序發送通知。當我發送通知並將其打開時,該應用完美無缺。不幸的是,即使我設置了廣播接收器,該應用在關閉時也不會收到通知當應用程序關閉時收到通知
<receiver
android:name="com.onesignal.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<receiver android:name="com.onesignal.BootUpReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<service android:name="com.onesignal.GcmIntentService" />
<service
android:name="com.onesignal.SyncService"
android:stopWithTask="false" />
請檢查這個答案類似於您的問題[?當應用程序被關閉如何獲得Android通知] (http://stackoverflow.com/questions/13741875/how-to-get-android-notifications-when-app-was-closed) – Shahrukh