【发布时间】:2017-09-26 06:20:32
【问题描述】:
我开发了一个使用 Mixpanel 推送通知的应用。它们运行良好,包括深度链接。
问题是我的客户希望它们在收到后发出声音,但他们不播放任何声音。
阅读文档后,我知道对于 iOS,就像在自定义数据中添加一个字段一样简单,但对于 Android,没有声场可以自定义它。 如果我没记错的话,唯一的解决方案是扩展 Mixpanel 广播接收器,所以我从这里更改了我的 AndroidManifest:
<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="my.package.name" />
</intent-filter>
</receiver>
到这里:
<receiver android:name=".auxiliary.LocalNotificationBroadcastReceiver"
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="my.package.name" />
</intent-filter>
</receiver>
我已经添加了这个类 .auxiliary.LocalNotificationBroadcastReceiver:
import com.mixpanel.android.mpmetrics.GCMReceiver;
public class LocalNotificationBroadcastReceiver extends GCMReceiver {
@Override
public void onReceive(final Context context, Intent intent) {
super.onReceive(context, intent);
}
}
这样从 Mixpanel 发送的推送通知仍然可以正确接收,但我不知道如何为该通知添加声音。
任何帮助将不胜感激!
【问题讨论】:
标签: android push-notification mixpanel