google cloud messaging errors on some devices

481 views Asked by At

I'm developing an Android app that should use the GCM to deliver notifications.

At the moment, I'm encountering problems with devices <= Android 4.0.4.

With my Galaxy Nexus (4.3), Nexus 7" (4.3) and a Fujitsu Tablet (4.1.1) I receive correctly the broadcast from GCM and I show a notification.

But with a HTC Incredible S (4.0.4) and HTC Flyer (3.2) the application doesn't receive nothing. Trying with the debug mode in Eclipse, infact, the application that run on these devices doesn't enter in onReceive() method.

Here's my AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xxx.yyy"
    android:versionCode="3"
    android:versionName="1.2" >

    <uses-sdk
        android:minSdkVersion="8" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <uses-feature android:name="android.hardware.camera"></uses-feature>

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_GPS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission android:name="com.seven.carserverapp.permission.C2D_MESSAGE" 
                    android:protectionLevel="signature" />
    <uses-permission android:name="com.example.gcmpush.sevenit.permission.C2D_MESSAGE" />    


    <permission
        android:name="com.xxx.yyy.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.xxx.yyy.permission.MAPS_RECEIVE"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" 
        >

        <receiver
            android:name=".GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >

            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.xxx.yyy" />
            </intent-filter>

        </receiver>

        <!-- PRODUCTION KEY -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="googleapikey"/>


        <activity
            android:name="xxx.yyy.SplashScreen"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:noHistory="true"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="Mappa" android:label="@string/title_Filiali" android:screenOrientation="portrait"></activity>
        <activity android:name="ParlaCon" android:label="@string/title_ContattiRapidi" android:screenOrientation="portrait"></activity>
        <activity android:name="Configurazione" android:label="@string/title_Login" android:screenOrientation="portrait"></activity>
        <activity android:name="IMieiDati" android:label="@string/title_DatiAnagr" android:screenOrientation="portrait"></activity>
        <activity android:name="ChiSiamo" android:label="@string/title_Noleggio" android:screenOrientation="portrait"></activity>
        <activity android:name="CompanyProfile" android:label="@string/title_CompanyProfile" android:screenOrientation="portrait"></activity>
        <activity android:name="GrandiAziende" android:label="@string/title_GrandiAziende" android:screenOrientation="portrait"></activity>
        <activity android:name="PMI" android:label="@string/title_PMI" android:screenOrientation="portrait"></activity>
        <activity android:name="Professionitsti" android:label="@string/title_Professionisti" android:screenOrientation="portrait"></activity>
        <activity android:name="FAQ" android:label="@string/title_FAQ" android:screenOrientation="portrait"></activity>
        <activity android:name="GuidaApp" android:label="@string/title_GuidaApp" android:screenOrientation="portrait"></activity>
        <activity android:name="IlMioNoleggio" android:label="@string/title_IlMioNoleggio" android:screenOrientation="portrait"></activity>
        <activity android:name="Main" android:label="@string/app_name" android:screenOrientation="portrait"></activity>
        <activity android:name="NewsSingola" android:label="@string/title_News" android:screenOrientation="portrait"></activity>
        <activity android:name="Km" android:label="@string/title_InsKM" android:screenOrientation="portrait"></activity>
        <activity android:name="KmResoconto" android:label="@string/title_ElencoKM" android:screenOrientation="portrait"></activity>
        <activity android:name="Manuale" android:label="@string/title_Manuale" android:screenOrientation="portrait"></activity>
        <activity android:name="ContattaConsulente" android:label="@string/title_ContattaConsulente" android:screenOrientation="portrait"></activity>
        <activity android:name="MainPublic" android:label="@string/app_name" android:screenOrientation="portrait"></activity>
        <activity android:name="PrevisioneConsegna" android:label="@string/title_PrevConsegna" android:screenOrientation="portrait"></activity>
        <activity android:name="CentriAssistenza" android:label="@string/title_CentriAssistenza" android:screenOrientation="portrait"></activity>
        <activity android:name="CentriAssistenzaMappa" android:label="@string/title_CentriAssistenza" android:screenOrientation="portrait"></activity>
        <activity android:name="CentroAssistenzaSingolo" android:label="@string/title_CentriAssistenza" android:screenOrientation="portrait"></activity>
        <activity android:name="ServiziContratto" android:label="@string/title_ServiziContratto" android:screenOrientation="portrait"></activity>

    </application>

</manifest>
1

There are 1 answers

0
Eran On BEST ANSWER

Quote from your manifest :

<permission android:name="com.seven.carserverapp.permission.C2D_MESSAGE" 
                android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcmpush.sevenit.permission.C2D_MESSAGE" />

The permission should be YOUR_PACKAGE.permission.C2D_MESSAGE, and it should be the same in the <permission> element and the <uses-permission> element.