Android Question Device Admin Application Screenlock

Discussion in 'Android Questions' started by iatall, Jun 5, 2015.

  1. iatall

    iatall Member Licensed User

    Hi.. My Question is about device admin application.
    I am developing device admin application.
    I have go through device admin library and documentation as per below links:
    http://www.b4x.com/android/forum/threads/device-administrator-library.19208/
    http://www.basic4ppc.com/android/help/administrator.html
    I want that other than phone owner not able to disable my app without password.

    [​IMG]

    As per shown in above screen if user unmark my application checkbox manually from settings, i want to immediately show lockscreen.
    So no one is able to disable it without password.
    I found this kind of feature in one of the playstore device admin app. App Link.
    Thanks in advance.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    As written in the tutorial the user can always disable your app (and they can always uninstall it). This is how the API is designed.

    The manager service will be started so you can do something when the user disables your app. I don't think that you will be able to lock the screen at that point as your app won't be allowed to call manager.LockScreen.
     
  3. iatall

    iatall Member Licensed User

    Thanks for reply Erel. means when user click on disable button within my app i able to show lockscreen.
    I also want to know how to wipe phone data. I found below code on forum:
    Code:
    Dim r As Reflector
    r.Target = Admin
    Dim rec As Object = r.GetField("rec")
    Dim dm As Object = r.GetField("dm")
    r.Target = dm
    r.RunMethod4(
    "setMaximumFailedPasswordsForWipe"Array As Object(rec, numberOfFailedPasswords), _
       
    Array As String("android.content.ComponentName""java.lang.int")
    Can you tell me what is "Admin" in this code? it shows me error:
    Is it same as AdminManager or else?
     
    Last edited: Jun 5, 2015
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is the AdminManager object. Have you added the wipe-data permission to the device_admin file?
     
  5. iatall

    iatall Member Licensed User

    Yes.. you are absolutely right. that was my fault.
    Just removed comment line <wipe-data /> from project folder/Objects/res/xml/device_admin.xml
    One can also be able to change password policy,encrypt storage or disable phone camera.
    Leaving here for others.
    Thanks for your help Erel :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice