其他
Android厂商推送冲突了。。。
https://carlwe.com/
...
implementation 'cn.jiguang.sdk:jpush:3.3.9'
implementation 'cn.jiguang.sdk:jcore:2.1.6'
implementation 'cn.jiguang.sdk.plugin:xiaomi:3.3.9'
implementation 'cn.jiguang.sdk.plugin:huawei:3.3.9'
implementation 'cn.jiguang.sdk.plugin:oppo:3.3.9'
...
}
问题一
android:name="com.netease.nimlib.mixpush.mi.MiPushReceiver"
android:exported="true">
<intent-filter android:priority="0x7fffffff"> //这里设置了优先级
<action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" />
<action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" />
<action android:name="com.xiaomi.mipush.ERROR" />
</intent-filter>
</receiver>
android:name="cn.jpush.android.service.PluginXiaomiPlatformsReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" />
</intent-filter>
<intent-filter>
<action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" />
</intent-filter>
<intent-filter>
<action android:name="com.xiaomi.mipush.ERROR" />
</intent-filter>
</receiver>
问题二
@Override
public final void onReceive(Context context, Intent intent) {}
public void onReceivePassThroughMessage(Context context, MiPushMessage message) {}
public void onNotificationMessageClicked(Context context, MiPushMessage message) {}
public void onNotificationMessageArrived(Context context, MiPushMessage message) {}
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {}
public void onCommandResult(Context context, MiPushCommandMessage message) {}
}
<intent-filter>
<action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE"/>
<action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED"/>
<action android:name="com.xiaomi.mipush.ERROR"/>
</intent-filter>
</receiver>
public MiPushReceiver() {}
public final void onNotificationMessageClicked(Context var1, MiPushMessage var2) {
if (g.a(var2.getExtra())) {
c.a(5).onNotificationClick(var1, var2); //自己处理
} else {
MiPushMessageReceiver var3;
if ((var3 = a.a(var1)) != null) {
var3.onNotificationMessageClicked(var1, var2);//交给MiPushMessageReceiver处理
}
}
}
...
}
寻求云信和极光的帮助
分析问题原理,找解决方案
分析作用
使用继承呢?
从需求出发
...
public class PluginXiaomiPlatformsReceiverYx extends MiPushMessageReceiver {
private static final String TAG = "XMPlatformsReceiver";
public PluginXiaomiPlatformsReceiverYx() {}
public void onReceivePassThroughMessage(Context var1, MiPushMessage var2) {
Logger.dd("XMPlatformsReceiver", "onReceivePassThroughMessage is called. " + var2);
}
public void onNotificationMessageClicked(Context var1, MiPushMessage var2) {
Logger.dd("XMPlatformsReceiver", "onNotificationMessageClicked is called. " + var2);
if (var2 == null) {
Logger.v("XMPlatformsReceiver", "message was null");
} else {
//虽然混淆了,但是用的都是极光sdk中的方法一样可以正常工作。
a.a(var1, var2, "action_notification_clicked");
}
}
...
}