gcm通知不适用于某些设备,如micromax

时间:2015-04-14 05:34:14

标签: android notifications google-cloud-messaging

同样的清单代码是

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.package_name.user"
    android:versionCode="1"
    android:versionName="1" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <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.READ_PHONE_STATE" >
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


    <uses-permission android:name="com.package_name.user.permission.C2D_MESSAGE"
       />
    <permission
        android:name="com.package_name.user.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
      <application
        android:name="com.package_name.user.AppController"
        android:allowBackup="true"

        >
   <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>

                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.package_name.gcm" />
            </intent-filter>
        </receiver>

        <service android:name="com.package_name.user.GCMIntentService" />

    </application>

</manifest> 

和广播接收器是

private final BroadcastReceiver mHandleMessageReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            String newMessage = intent.getExtras().getString(
                    GCMConfig.EXTRA_MESSAGE);

            // Waking up mobile if it is sleeping
            aController.acquireWakeLock(getApplicationContext());

            // Display message on the screen
            // lblMessage.append(newMessage + "\n");

            // Releasing wake lock
            aController.releaseWakeLock();
        }
    };

在所有设备上工作但不在micromax中联合a160拥有Android版本21 测试了GCM的c2dm和谷歌播放服务方法都在其他设备上工作但不在micromax上请建议解决方案

0 个答案:

没有答案