美文网首页
融云和极光华为推送冲突处理

融云和极光华为推送冲突处理

作者: 你的益达233 | 来源:发表于2020-07-25 15:48 被阅读0次

融云SDK版本:4.0.0.3
极光SDK版本:3.6.8
记得是这两个版本,或者看下极光,融云最新文档对华为版本的支持是不是一致,要不然你解决jar,清单配置等一系列问题就头疼了,而且明确说是解决不了的。

配置

因为极光中已经有com.huawei.android.hms:base,所以app.build只需要引入
implementation 'com.huawei.hms:push:4.0.2.300'

清单配置

<meta-data
        android:name="com.huawei.hms.client.appid"
        android:value="你的华为的appid" />
    <!-- BridgeActivity定义了HMS-SDK中一些跳转所需要的透明页面-->
    <activity
        android:name="com.huawei.hms.activity.BridgeActivity"
        android:configChanges="orientation|locale|layoutDirection|fontScale|screenSize|smallestScreenSize|screenLayout"
        android:excludeFromRecents="true"
        android:exported="false"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent" >
        <meta-data
            android:name="hwc-theme"
            android:value="androidhwext:style/Theme.Emui.Translucent" />
    </activity>


    <provider
        android:name="com.huawei.hms.update.provider.UpdateProvider"
        android:authorities="${APPLICATIONID}.hms.update.provider"
        android:exported="false"
        android:grantUriPermissions="true">
    </provider>
    <!--这个已经不需要-->
<!--<receiver android:name=".im.push.HWPushReceiver" android:exported="false">-->
<!--<intent-filter android:priority="0x7fffffff">-->
<!--&lt;!&ndash; 必须,用于接收token &ndash;&gt;-->
<!--<action android:name="com.huawei.android.push.intent.REGISTRATION" />-->
<!--&lt;!&ndash; 必须,用于接收消息 &ndash;&gt;-->
<!--<action android:name="com.huawei.android.push.intent.RECEIVE" />-->
<!--&lt;!&ndash; 可选,用于点击通知栏或通知栏上的按钮后触发onEvent回调 &ndash;&gt;-->
<!--<action android:name="com.huawei.android.push.intent.CLICK" />-->
<!--&lt;!&ndash; 可选,查看push通道是否连接,不查看则不需要 &ndash;&gt;-->
<!--<action android:name="com.huawei.intent.action.PUSH_STATE" />-->
<!--</intent-filter>-->
<!--</receiver>-->
    <service android:name=".im.push.HWPushService" android:exported="false">
        <intent-filter>
            <action android:name="com.huawei.push.action.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <service
        android:name="cn.jpush.android.service.PluginHuaweiPlatformsService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.huawei.push.action.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <!--华为推送配置结束-->

记得PluginHuaweiPlatformsService极光的也要注册,否则极光的推送收不到

还有最重要的点

极光的Rest Api需要配置third_party_channel的"huawei":{"distribution":"secondary_push"}
这样设置为了一个需求app后台运行,点击通知栏能跳转到相应界面。app不运行的情况下,启动应用即可

相关文章

网友评论

      本文标题:融云和极光华为推送冲突处理

      本文链接:https://www.haomeiwen.com/subject/dtcmlktx.html