Apptentive GCM notification behaving differently when app is not in focus

82 views Asked by At

I integrated my android app with apptentive as per GCM instructions in https://docs.apptentive.com/android/integration/

When I reply to a message from apptentive web UI, I am observing two notification behaviors at app side.

When app is opened, my own GCM listener is getting called. When app is not in opened state, my own GCM listener is not getting called, however I am seeing a notification with app's default icon, "You have a new message" " ".

I am not sure who is creating this new/unwanted notification. It is causing problem because, clicking this new notification is taking user to my activity, but not opening message center.

Specs: Sdk version is 2.1.3 Device running Android 5.1.1

<?xml version="1.0" encoding="utf-8"?>

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

<!-- Used by apptentive to get email address automatically. This permission is optional.  -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

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


<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true" />

<application
    android:name="DubaiGoldPriceApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="org.chittu.dubaigoldprices.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths" />
    </provider>

    <!-- The following is required -->
    <!-- Include your App's API key from Apptentive at "Settings -> API & Development" -->
    <meta-data
        android:name="apptentive_api_key"
        android:value="<APIKEY>" />
    <activity
        android:name="com.apptentive.android.sdk.ViewActivity"
        android:theme="@style/ApptentiveTheme" />

    <!-- FB integration -->
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />
    <provider android:authorities="com.facebook.app.FacebookContentProvider<SDKID>"
        android:name="com.facebook.FacebookContentProvider"
        android:exported="true"/>
    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />

    <!-- [START gcm_receiver] -->
    <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="org.chittu.dubaigoldprices" />
        </intent-filter>
    </receiver>
    <!-- [END gcm_receiver] -->

    <!-- [START gcm_listener] -->
    <service
        android:name="org.chittu.dubaigoldprices.MyGcmListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
    </service>
    <!-- [END gcm_listener] -->
    <!-- [START instanceId_listener] -->
    <service
        android:name="org.chittu.dubaigoldprices.MyInstanceIDListenerService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.gms.iid.InstanceID"/>
        </intent-filter>
    </service>
    <!-- [END instanceId_listener] -->
    <service
        android:name="org.chittu.dubaigoldprices.RegistrationIntentService"
        android:exported="false">
    </service>
</application>

0

There are 0 answers