问题描述
我试图创建一个应用程序,允许用户从一个网站的密码锁他的机器人设备。所以,我必须找到一个方法以编程方式锁定设备,它的意思是没有任何一个有code,让我来为设备设置一个密码,当我解开我的屏幕,它要求输入code进入到家庭?
I'm trying to create an application that allow the user to lock his android device with a password from a website. So i must find a method to lock the device programmatically, it means is there any one that have a code that allow me to set a password for the device and when i unlock my screen it demands to enter the code to access to the home?
推荐答案
选择的答案是正确的金钱。
The selected answer is right on the money.
话说回来,如果你有兴趣,这里是一些示例code,你可以看看:
Having said that, if you are interested, here is some sample code you can take a look at:
执行远程锁定和远程抹了PolicyManager:<一href="http://openmobster.google$c$c.com/svn/trunk/cloud/android/connection/src/main/java/org/openmobster/core/mobileCloud/android/module/connection/PolicyManager.java" rel="nofollow">http://openmobster.google$c$c.com/svn/trunk/cloud/android/connection/src/main/java/org/openmobster/core/mobileCloud/android/module/connection/PolicyManager.java
A PolicyManager that performs remote Locking and remote wiping:http://openmobster.googlecode.com/svn/trunk/cloud/android/connection/src/main/java/org/openmobster/core/mobileCloud/android/module/connection/PolicyManager.java
接收器的AndroidManifest声明:
The AndroidManifest declaration of the receiver:
<receiver android:name="org.openmobster.core.mobileCloud.android.module.connection.PolicyManager$PolicyReceiver"
android:label="OpenMobster Device Administrator"
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:<一href="http://openmobster.google$c$c.com/svn/trunk/cloud/android/cloudManager/res/xml/device_admin.xml" rel="nofollow">http://openmobster.google$c$c.com/svn/trunk/cloud/android/cloudManager/res/xml/device_admin.xml
这应该给的PolicyManager code一个想法,其相应的配置。
This should give an idea of the PolicyManager code and its corresponding configuration.
作为每个提供服务器和设备之间的通信的推移,则可以使用两个实体之间的持续TCP连接。这里是如何做到这一点的一些示例code
As per providing a communication between the server and the device goes, you can use a persistent TCP connection between the two entities. Here is some sample code on how to do that
创建和管理一个持久的TCP套接字:<一href="http://openmobster.google$c$c.com/svn/trunk/cloud/android/connection/src/main/java/org/openmobster/core/mobileCloud/android/module/connection/NotificationListener.java" rel="nofollow">http://openmobster.google$c$c.com/svn/trunk/cloud/android/connection/src/main/java/org/openmobster/core/mobileCloud/android/module/connection/NotificationListener.java
Creating and Managing a persistent TCP socket: http://openmobster.googlecode.com/svn/trunk/cloud/android/connection/src/main/java/org/openmobster/core/mobileCloud/android/module/connection/NotificationListener.java
希望这有助于入门
这篇关于怎样才能锁定的Android设备使用密码编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!