问题描述
移动推送检测到小米SDK自启动行为:扫描堆栈中有 com.xiaomi.push.service.receivers.NetworkStatusReceiver action=android.net.conn.CONNECTIVITY_CHANGE
APP频繁自启动和关联启动
APP未向用户明示未经用户同意,且无合理的使用场景,存在频繁自启动或关联启动的行为。
问题原因
小米应用市场会检测出这个检测网络变化的action。判断为自启动行为
解决方案(选其中一种即可)
- 使用原生集成升级小米sdk 。辅助弹框不用改直接复用即可。
// implementation "com.aliyun.ams:alicloud-android-third-push-xiaomi:3.8.4" // 注释这个
implementation "com.aliyun.ams:alicloud-android-third-push:3.8.4@aar" // 换成这个
ThirdPushManager.reportToken(context, ThirdPushReportKeyword.XIAOMI.thirdTokenKeyword, token);
删除EMAS初始化 小米sdk的调用, 改为自己初始化
// MiPushRegister.register(this, ThirdKeys.xiaomiId, ThirdKeys.xiaomiKey);
- 在清单文件移除CONNECTIVITY_CHANGE 。
<receiver
android:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver"
android:exported="true"
tools:node="merge">
<intent-filter tools:node="remove">
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>