我已经为推送通知设置了WakefulReceiver和IntentService,就像它们在GCM教程中的显示方式一样。 我在Android 4.1.x及更高版本(.2,.3,.4)的大多数设备版本中都没有发出通知,没问题。
然而,在版本4.0.3上,我的清醒接收器甚至没有开火。我已经查看了权限,因为这是我在网上看到的,但我已经三次检查了权限,它们似乎很好。
4.0.3或其他一些导致是否存在已知问题?
这是我的Android清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.companyname.mobile.appname"
android:versionCode="1"
android:versionName="0.2" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<permission
android:name="com.companyname.appname.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.companyname.appname.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/myLauncherIcon"
android:label="@string/launcher_name"
android:largeHeap="true"
android:logo="@drawable/myLogo"
android:theme="@style/Theme.MyAppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.companyname.appname.activity.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.companyname.appname.activity.HomeActivity"
android:configChanges="keyboardHidden"
android:windowSoftInputMode="stateHidden" >
</activity>
<receiver
android:name="com.companyname.appname.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.companyname.appname" />
</intent-filter>
</receiver>
<service android:name="com.companyname.appname.GcmIntentService" />
</application>