安卓開發環信即時通信

最近花了一個星期的時間在B站跟着老師學了環信即時聊天工具的使用

附上學習網站:https://www.bilibili.com/video/BV1cW411V7yd?p=1

附上自己的代碼 https://code.aliyun.com/873044564/IMHuanXin?spm=a2111a.8458726.0.0.6c6c35315D9ibA

因爲視頻錄製時間是2016年的所以在開發中也是遇到不少問題,總結如下:

1.v4包不兼容問題解決:
https://blog.csdn.net/weixin_44880903/article/details/104408886

2.註冊不成功問題解決:
這個我覺得是高版本安卓網絡權限的問題
manifest中加入:

<meta-data
            android:name="com.google.android.actions"
            android:resource="@xml/network_security_config" />
<uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />

在res中創建一個actions xml file

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" overridePins="true" />
            <certificates src="user" overridePins="true" />
        </trust-anchors>
    </base-config>
</network-security-config>

3.EaseChatFragment因升級到AndroidX後不能進入聊天界面的問題
https://blog.csdn.net/weixin_44880903/article/details/104528309

4.在聊天界面點擊圖片和位置或者就閃退的問題  ||  點擊放大圖片就閃退 || 點擊位置沒有具體圖畫

 在manifest中需要加的代碼

 <!-- 百度地圖所需的service -->
        <service
            android:name="com.baidu.location.f"
            android:enabled="true"
            android:process=":remote" />

        <meta-data
            android:name="com.baidu.lbsapi.API_KEY"
            android:value="3ecea51f560650b1ed8a4b99808f52e8" />

        <activity android:name="com.hyphenate.easeui.ui.EaseBaiduMapActivity" /> 
<!-- 顯示大圖頁面 -->
        <activity android:name="com.hyphenate.easeui.ui.EaseShowBigImageActivity" />

  <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.hyphenate.easeui.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_path" />
        </provider>

首先是權限的問題,大家都知道安卓6.0之後就需要動態申請權限了

再之後安卓7.0FileProvider也要處理了

在xml中創建一個file_path.xml

<paths>
    <external-path
        name="external_files"
        path="."/>
</paths>

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章