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?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
The selected answer is right on the money.
Having said that, if you are interested, here is some sample code you can take a look at:
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
The AndroidManifest declaration of the receiver:
res/xml/device_admin.xml: http://openmobster.googlecode.com/svn/trunk/cloud/android/cloudManager/res/xml/device_admin.xml
This should give an idea of the PolicyManager code and its corresponding configuration.
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
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
Hope this helps with getting started
check of DevicePolicyManager, http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html
specifically, the resetPassword, and lockNow() methods.
please read the entire device admin tutorial to understand how to use DPM in context, http://developer.android.com/guide/topics/admin/device-admin.html
as for locking from the website. android c2dm is the preferred way to get push messages to the device. http://code.google.com/android/c2dm/
note however that this is intended for occasional "wake up" messages, not for any sort of 2-way communication between the device and some other entity.