环信UI开源Demo情景分析二、清单文件

慎兴业
2023-12-01

废话不多说,上代码:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.easemob.chatuidemo"
    android:versionCode="12"
    android:versionName="2.1.8" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="19" />

    <!-- 允许访问振动设备 -->
    <uses-permission android:name="android.permission.VIBRATE" />
    <!-- 允许访问网络 -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- 允许程序录制音频 -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <!-- 允许程序使用摄像头 -->
    <uses-permission android:name="android.permission.CAMERA" />
    <!-- 允许程序操作网络状态 -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- 获取模拟定位信息,一般用于帮助开发者调试应用 -->
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
    <!-- 允许程序写入外部存储,如SD卡上写文件 -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- 挂载、反挂载外部文件系统 -->
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <!-- 通过GPS芯片接收卫星的定位信息,定位精度达10米以内 -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- 允许一个程序获取信息有关当前或最近运行的任务,一个缩略的任务状态,是否活动等等 -->
    <uses-permission android:name="android.permission.GET_TASKS" />
    <!-- 允许程序访问Wi-Fi网络状态信息 -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <!-- 允许程序改变Wi-Fi连接状态 -->
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <!-- 允许程序在手机屏幕关闭后后台进程仍然运行 -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- 修改声音设置信息 -->
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <!-- 访问电话状态 -->
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <!-- 允许程序开机自动运行 -->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <!-- 访问GMail账户列表 -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <!-- 允许程序请求验证从AccountManager -->
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <!-- 允许程序管理AccountManager中的账户列表 -->
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <!-- 允许一个程序通过账户验证方式访问账户管理ACCOUNT_MANAGER相关信息 -->
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
    <!-- 允许应用程序获取主屏幕中的设置和快捷方式 -->
    <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
    <!-- 允许一个程序收到广播后快速收到下一个广播 -->
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
    <!-- 允许读写系统设置项 -->
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />

    <!-- 建议将allowBackup属性值显示设置为false,关闭应用备份功能 -->
    <application
        android:name="DemoApplication"
        android:allowBackup="true"
        android:icon="@drawable/logo_uidemo"
        android:label="@string/app_name" >
        <!-- 开屏页 -->
        <activity
            android:name=".activity.SplashActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- 登陆 -->
        <activity
            android:name=".activity.LoginActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>

        <!-- 注册 -->
        <activity
            android:name=".activity.RegisterActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <activity
            android:name=".activity.MainActivity"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <!-- 聊天页面 -->
        <activity
            android:name=".activity.ChatActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustResize" >
        </activity>
        <!-- 添加好友 -->
        <activity
            android:name=".activity.AddContactActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 群组详情 -->
        <activity
            android:name=".activity.GroupDetailsActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 群组列表 -->
        <activity
            android:name=".activity.GroupsActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <!-- 新建群组 -->
        <activity
            android:name=".activity.NewGroupActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <!-- 退出群组提示框 -->
        <activity
            android:name=".activity.ExitGroupDialog"
            android:screenOrientation="portrait"
            android:theme="@style/MyDialogStyleBottom" >
        </activity>
        <!-- 群组选人 -->
        <activity
            android:name=".activity.GroupPickContactsActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <!-- 地图 -->
        <activity
            android:name="com.easemob.chatuidemo.activity.BaiduMapActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>

        <!-- 新的朋友邀请消息页面 -->
        <activity
            android:name=".activity.NewFriendsMsgActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 转发消息用户列表页面 -->
        <activity
            android:name=".activity.ForwardMessageActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <!-- 自定义的contextmenu -->
        <activity
            android:name=".activity.ContextMenu"
            android:screenOrientation="portrait"
            android:theme="@style/MyDialogStyle" >
        </activity>
        <!-- 自定义的alertdialog -->
        <activity
            android:name=".activity.AlertDialog"
            android:screenOrientation="portrait"
            android:theme="@style/MyDialogStyle" >
        </activity>
        <!-- 显示下载大图页面 -->
        <activity
            android:name=".activity.ShowBigImage"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 下载文件 -->
        <activity
            android:name=".activity.ShowNormalFileActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 黑名单 -->
        <activity
            android:name=".activity.BlacklistActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>

        <!-- 公开的群聊列表 -->
        <activity
            android:name=".activity.PublicGroupsActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <!-- 语音通话 -->
        <activity
            android:name=".activity.VoiceCallActivity"
            android:screenOrientation="portrait"
            android:theme="@style/nornal_style" >
        </activity>
        <!-- 视频通话 -->
        <activity
            android:name=".activity.VideoCallActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 群聊简单信息 -->
        <activity
            android:name=".activity.GroupSimpleDetailActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <!-- 群组黑名单用户列表 -->
        <activity
            android:name=".activity.GroupBlacklistActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide" >
        </activity>
        <activity
            android:name=".activity.EditActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="stateVisible" >
        </activity>
        <activity
            android:name=".activity.ShowVideoActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <!-- choose video -->
        <activity
            android:name=".activity.ImageGridActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <activity
            android:name=".activity.RecorderVideoActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <!-- upload error log -->
        <activity
            android:name=".activity.DiagnoseActivity"
            android:screenOrientation="portrait"
            android:theme="@style/horizontal_slide"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>

        <!-- 开机自启动服务 -->
        <receiver android:name="com.easemob.chat.StartServiceReceiver" >
            <intent-filter android:priority="1000" >
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </receiver>

        <!-- 设置环信应用的appkey -->
        <meta-data
            android:name="EASEMOB_APPKEY"
            android:value="easemob-demo#chatdemoui" />
        <!-- 声明sdk所需的service -->
        <service android:name="com.easemob.chat.EMChatService" />

        <!-- 百度地图所需的service -->
        <service
            android:name="com.baidu.location.f"
            android:enabled="true"
            android:process=":remote" />
        <!-- umeng appkey,可忽略 -->
        <meta-data
            android:name="UMENG_APPKEY"
            android:value="53912a3156240b01a7075ed1" >
        </meta-data>
        <meta-data
            android:name="com.baidu.lbsapi.API_KEY"
            android:value="3ecea51f560650b1ed8a4b99808f52e8" />
    </application>

</manifest>
其中相关权限已用通俗易懂的中文注释了,不清楚的童鞋可以自行百度。

其中在application里面,有一点不是很明白:allowBackup设置true不是很理解,或者是因为这个Demo是供开发人员使用的,相关信息可以参考《Android属性allowBackup安全风险浅析》

其中Activity都是设置竖屏,并且拥有一个开机启动的服务<receiver android:name="com.easemob.chat.StartServiceReceiver" >,还有一个百度地图的service,应该是用来定位的。


 类似资料: