2

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>

  • Do you have more than one receiver registered for `com.google.android.c2dm.intent.RECEIVE`? If so, you may need to only have one receiver handle that Intent. Also, Apptentive doesn't display a Notification by default, so if an extra notification is being displayed, perhaps you accidentally copied the example code? – Sky Kelsey Apr 18 '16 at 18:19
  • Thanks for responding. I don't have multiple receivers. Attached manifest file in the question. Which example code, could you please give reference to example code which is probable cause foe this problem? – Creative Cubs Apr 18 '16 at 20:47
  • I'm seeing the exact same issue in my app. Did you ever figure out what was causing the issue? – Adam Johns May 06 '16 at 07:48
  • My issue was actually a server issue. The server was sending notification messages, but should have been sending data messages. https://github.com/googlesamples/google-services/issues/166 – Adam Johns May 06 '16 at 08:53
  • See my answer here: http://stackoverflow.com/a/37067866/1438339 – Adam Johns May 06 '16 at 16:27
  • Adam Johns, Thanks for the answer. @SkyKelsey – Creative Cubs May 07 '16 at 05:52

0 Answers0