简体   繁体   中英

mixpanel push notification is sending 2 notifications

I am using mixpanel in my app and I am getting 2 notifications from mixpanel. I am already using gcm on my device for chat. How can I receive both mixpanel and my notifications. BTW I generate GCM reg_id via code.

Manifest file:

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

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

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

        <receiver android:name="com.mixpanel.android.mpmetrics.GCMReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >

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

 <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.example.Mainactivity.gcm" />
            </intent-filter>
        </receiver>

        <service android:name=".gcm.GcmIntentService" />

I have added :

     mixpanel.registerSuperProperties(props);
 mixpanel.identify(id);
mixpanel.getPeople().identify(id);
 mixpanel.getPeople().setPushRegistrationId(reg_id);
 mixpanel.getPeople().initPushHandling(SENDER_ID);

in my GcmBroadcastReceiver I have added:

if (intent.getExtras().containsKey("mp_message")) {
               String mp_message=intent.getExtras().getString("mp_message");
}

检查您是否在多人的属性中添加了相同的设备令牌(以逗号分隔)

As you are saying you implemented GCM before and you integrated Mixpanel afterwards. In that case you should remove the Mixpanel GCMReceiver tag as mentioned in the official documentation:

If you are handling registration and receiving notifications yourself, you shouldn't include the Mixpanel GCMReceiver tag in your AndroidManifest.xml file.

https://mixpanel.com/help/reference/android-push-notifications

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM