简体   繁体   English

mixpanel推送通知正在发送2个通知

[英]mixpanel push notification is sending 2 notifications

I am using mixpanel in my app and I am getting 2 notifications from mixpanel. 我在我的应用程序中使用mixpanel,我从mixpanel收到2个通知。 I am already using gcm on my device for chat. 我已经在我的设备上使用gcm进行聊天了。 How can I receive both mixpanel and my notifications. 如何同时收到mixpanel和我的通知。 BTW I generate GCM reg_id via code. 顺便说一句,我通过代码生成GCM reg_id。

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: 在我的GcmBroadcastReceiver中我添加了:

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. 正如您所说,您之前实施了GCM,之后又集成了Mixpanel。 In that case you should remove the Mixpanel GCMReceiver tag as mentioned in the official documentation: 在这种情况下,您应该删除官方文档中提到的Mixpanel GCMReceiver标记:

If you are handling registration and receiving notifications yourself, you shouldn't include the Mixpanel GCMReceiver tag in your AndroidManifest.xml file. 如果您自己处理注册和接收通知,则不应在AndroidManifest.xml文件中包含Mixpanel GCMReceiver标记。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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