17_使用设备管理器

来源:互联网 发布:链轮链条设计软件 编辑:程序博客网 时间:2024/06/05 08:37

使用设备管理器

设备管理器的使用流程

 

 

我们先要写一个Receiver继承DeviceAdminReceiver

 

 

然后在清单文件里注册Receiver

 

        <receiver

            android:name=".receiver.SafeDeviceAdminReceiver"

            android:description="@string/device_admin_description"

            android:label="@string/device_admin"

            android:permission="android.permission.BIND_DEVICE_ADMIN" >

            <meta-data

                android:name="android.app.device_admin"

                android:resource="@xml/device_admin" />

 

            <intent-filter>

                <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />

            </intent-filter>

        </receiver>

 

 

然后在res文件夹下创建xml文件夹,创建device_admin.xml文件

 

 

<device-admin xmlns:android="http://schemas.android.com/apk/res/android" >

 

    <!-- 设备管理器权限列表,用不到可以注释掉 -->

    <uses-policies>

        <!-- <limit-password /> -->

 

        <!-- <watch-login /> -->

 

        <!-- 重置密码 -->

        <reset-password />

 

        <!-- 强制锁屏 -->

        <force-lock />

 

        <!-- 擦除数据 -->

        <wipe-data />

 

        <!-- <expire-password /> -->

 

        <!-- <encrypted-storage /> -->

 

        <!-- <disable-camera /> -->

    </uses-policies>

 

</device-admin>

 

 

 

 

 

 

 

 

 

 

 

0 0
原创粉丝点击