shashank kapoor
shashank kapoor

Reputation: 45

Google push notification not reaching the app

I have an app that receives a push notification that my server sends and does further processing. The push notification and everything is working fine on a number of phones. However, there is one phone from a local manufacturer - Micromax A27 - for which my app's broadcast receiver's onReceive never gets called. I tried everything but it's a no go. Does anybody know how to fix this?

Below is my manifest code for registering the receiver:

    <receiver
        android:name="gcm.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter android:priority="999">
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.wheels.driver" />
        </intent-filter>
    </receiver>

Please note that the above code works on all phones that I have tested till now, except on a particular model - Micromax A27.

The full Manifest:

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

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <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_CONTACTS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

       <receiver
            android:name="gcm.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter android:priority="999">
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.wheels.driver" />
            </intent-filter>
        </receiver>
        <service android:name="gcm.GcmIntentService" />

        <activity
            android:name="com.wheels.driver.SplashScreen"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name="com.wheels.driver.Home"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
         </activity>

        <activity
            android:name="com.wheels.driver.Login"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
         </activity>
          <activity
            android:name="com.wheels.driver.RequestDetails"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
         </activity>

           <activity
            android:name="com.wheels.driver.TripStarted"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
         </activity>


    </application>

</manifest>

Upvotes: 0

Views: 1179

Answers (1)

Eran
Eran

Reputation: 393781

You are missing the following permissions :

<permission android:name="com.wheels.driver.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />
<uses-permission android:name="com.wheels.driver.permission.C2D_MESSAGE" />

For some reason this error prevents GCM from working only on older Android devices (even though the official GCM code samples state that it's required).

Upvotes: 1

Related Questions