简体   繁体   English

在Android 5.0上重新启动后,应用程序不会收到GCM消息

[英]App does not receive GCM messages after reboot on Android 5.0

I use react-native-gcm-android and react-native-system-notification packages to manage GCM notifications (Android), everything works fine on Android 4.x but on 5.0 (ASUS_Z00AD) after reboot GCM messages not appear, log shows me 我使用react-native-gcm-androidreact-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) }

In AndroidManifest.xml all the settings are made according the packages documentation: 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 Services library is com.google.android.gms:play-services-gcm:8.4.0 Google Play服务库是com.google.android.gms:play-services-gcm:8.4.0

Finally I solved the puzzle... 最后我解开了这个难题......

Application doesn't start at boot-up because it was blocked by Asus utility "Auto-start manager" - all recently installed apps are blocked by default. 应用程序无法在启动时启动,因为它被Asus实用程序“自动启动管理器”阻止 - 所有最近安装的应用程序都默认被阻止。

So now I will add a check for com.asus.mobilemanager package with alert and button to start this utility and unblock autorun, but I think the correct way will be detect all possible blocking software and inform user about it. 所以现在我将添加一个com.asus.mobilemanager包的检查, com.asus.mobilemanager包含alert和button来启动此实用程序并取消阻止自动运行,但我认为正确的方法是检测所有可能的阻止软件并通知用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM