[英]App does not receive GCM messages after reboot on Android 5.0
我使用react-native-gcm-android
和react-native-system-notification
軟件包來管理GCM通知(Android),一切正常在Android 4.x上工作但在5.0(ASUS_Z00AD)重啟GCM消息后沒有出現,日志顯示我
W/BroadcastQueue( 639): Reject to launch app com.Sgoomys.Main/10246 for broadcast: App Op 48
W/GCM-DMM ( 1824): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.Sgoomys.Main (has extras) }
在AndroidManifest.xml
所有設置都是根據包文檔進行的:
<permission
android:name="com.Sgoomys.Main.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.Sgoomys.Main.permission.C2D_MESSAGE" />
...
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.Sgoomys.Main" />
</intent-filter>
</receiver>
<service android:name="com.oney.gcm.GcmRegistrationService"/>
<service android:name="com.oney.gcm.BackgroundService"></service>
<service
android:name="io.neson.react.notification.GCMNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<receiver
android:exported="false"
android:name="com.oney.gcm.GcmBroadcastReceiver">
<intent-filter>
<action android:name="com.oney.gcm.GCMReceiveNotification" />
</intent-filter>
</receiver>
Google Play服務庫是com.google.android.gms:play-services-gcm:8.4.0
最后我解開了這個難題......
應用程序無法在啟動時啟動,因為它被Asus實用程序“自動啟動管理器”阻止 - 所有最近安裝的應用程序都默認被阻止。
所以現在我將添加一個com.asus.mobilemanager
包的檢查, com.asus.mobilemanager
包含alert和button來啟動此實用程序並取消阻止自動運行,但我認為正確的方法是檢測所有可能的阻止軟件並通知用戶。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.