04/29/2024 11:54:53

问题描述

小米厂商渠道频繁获取设备信息

图片描述

问题原因

小米厂商 SDK 问题。

解决方案

可以参考方案 a)或方案 b)进行处理。
a)不接入小米厂商渠道
需要做以下操作:
① 移除依赖语句 implementation "com.tencent.tpns:xiaomi:$tpns_version"
示例如下图所示:

图片描述

② 删除 AndroidManifest.xml 中的小米厂商渠道配置。

删除小米推送的配置:

<application>
    <service
        android:name="com.xiaomi.push.service.XMPushService"
        android:enabled="true"
        android:process=":pushservice" />
    <service
        android:name="com.xiaomi.push.service.XMJobService"
        android:enabled="true"
        android:exported="false"
        android:permission="android.permission.BIND_JOB_SERVICE"
        android:process=":pushservice" />
    <!-- 注:此service必须在3.0.1版本以后(包括3.0.1版本)加入 -->
    <service
        android:name="com.xiaomi.mipush.sdk.PushMessageHandler"
        android:enabled="true"
        android:exported="true" />
    <service
        android:name="com.xiaomi.mipush.sdk.MessageHandleService"
        android:enabled="true" />
    <!-- 注:此service必须在2.2.5版本以后(包括2.2.5版本)加入 -->
    <receiver
        android:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver"
        android:exported="true" >
        <intent-filter>
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
    <receiver
        android:name="com.xiaomi.push.service.receivers.PingReceiver"
        android:exported="false"
        android:process=":pushservice" >
        <intent-filter>
            <action android:name="com.xiaomi.push.PING_TIMER" />
        </intent-filter>
    </receiver>
    <receiver
    android:exported="true"
    android:name="com.tencent.android.mipush.XMPushMessageReceiver">
    <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>
</application>

<!-- 注:小米push 需要的权限 begin -->
<permission
    android:name="应用包名.permission.MIPUSH_RECEIVE"
    android:protectionLevel="signature" />
<!-- 这里 应用包名 改成app的包名 -->

<uses-permission android:name="应用包名.permission.MIPUSH_RECEIVE" />
<!-- 这里 应用包名 改成app的包名 -->
<!-- 注:小米push 需要的权限 end -->

③ MSDKConfig.ini 配置 XG_XIAOMI_ENABLE为 0 ,关闭小米渠道支持。

# TPNS XIAOMI 厂商渠道配置
XG_XIAOMI_ENABLE = 0

④ 删除小米厂商渠道代码混淆。

-keep class com.xiaomi.**{*;}
-keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver

⑤ 如果是 internal 接入,还需要删除小米厂商渠道相关 jar 包,直接删除 gcloudsdk-xiaomi-$version 目录。

b)如需接入小米厂商渠道并解决频繁获取设备信息的问题
当前需要联系 TPNS 侧指引接入小米厂商渠道海外版,接口人:2000(TEG技术支持)。



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""