我使用播放服务8.4实现了GCM推送通知,并通过高优先级的php发送。 在我的Android 4.3中,我收到消息,即使几分钟后,带有Android 5.1的J5三星可能需要几个小时甚至有时甚至都没有收到。 我遵循gcm的谷歌实施指南。 在诊断消息跟踪令牌的J5的GCM时,它表示为GCM收到,但没有其他内容。 其他应用程序(whatsapp)上的J5即使在待机状态下也会收到通知,但不是我的。现在正是我寻求解决方案。 我试图通过警报来唤醒管理器应用程序输入这个,我尝试了谷歌建议的所有机制,但没有。 我找到了有关'HeartBeat的信息,但我明白只会减少设备与GCM的联系时间(从28分钟到移动连接中的任意数量),但情况不会改变。 我不在乎这个消息是在一小时之后发出的,但重要的是在我去世前到达。 救命啊!
<div class="character-one"></div>
PHP中的有效负载:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.customer.myapp"
android:installLocation="auto"
android:versionCode="20"
android:versionName="1.4.4" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="23"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"
/>
<permission android:name="com.customer.myapp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.customer.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="23"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"
android:maxSdkVersion="23"/>
<application
android:allowBackup="true"
android:icon="@drawable/main_logo"
android:label="@string/app_name"
android:logo="@drawable/main_logo" >
<activity
android:name=".Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- .GcmBroadcastReceiver, Aggiunto exported -->
<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.customer.myapp" />
</intent-filter>
</receiver>
<service
android:name=".MyGCMListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name=".MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<receiver
android:name=".Boot"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".FBActivity"
android:label="@string/title_activity_fb"
android:parentActivityName=".Main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.customer.myapp.Main" />
</activity>
<activity
android:name="com.facebook.LoginActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/app_id" />
<provider
android:name="com.facebook.NativeAppCallContentProvider"
android:authorities="com.facebook.app.NativeAppCallContentProviderXXXXXXXXX"
android:exported="true" />
<receiver android:name=".FacebookBroadcastReceiver" >
<intent-filter>
<action
android:name="com.facebook.platform.AppCallResultBroadcast" />
</intent-filter>
</receiver>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity
android:name=".WebviewAct"
android:label="@string/title_activity_webview"
android:parentActivityName=".Main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.customer.myapp.Main" />
</activity>
<activity
android:name=".ArgomentiActivity"
android:label="@string/title_activity_argomenti"
android:parentActivityName=".Main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.customer.myapp.Main" />
</activity>
<activity
android:name=".Luoghi"
android:label="@string/title_activity_luoghi" >
</activity>
<activity
android:name=".InfoActivity"
android:label="@string/title_activity_info" >
</activity>
<service android:name=".RegistrationIntentService"
android:exported="false"></service>
<receiver android:process=":remote" android:name=".BroadcastFormyapp">
</receiver>
<receiver android:name=".AutoStart">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<service
android:name=".ServiceAlarm"
android:enabled="true"
> <!-- android:process=":" -->
</service>
<service
android:name=".GcmIntentService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
</application>
</manifest>