B4A Library Device Administrator library

Status
Not open for further replies.

ilan

Expert
Licensed User
Longtime User
if somene wants only to lock the screen without password request do it like this

B4X:
#Region Module Attributes
    #StartAtBoot: False
#End Region

'Service module
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub
Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)
    If StartingIntent.HasExtra("admin") Then
        Select StartingIntent.GetExtra("admin")
            Case "Enabled"
                Log("admin enabled")
                AdminEnabled
            Case "Disabled"
                Log("admin disabled")
            Case "PasswordChanged"
                Log("Password changed")
        End Select
    End If
End Sub
Sub AdminEnabled
    dojob.manager.SetPasswordQuality(dojob.manager.PASSWORD_QUALITY_NUMERIC, 4)
'    If dojob.manager.PasswordSufficient = False Then
'        dojob.manager.RequestNewPassword
'    End If
End Sub
Sub Service_Destroy

End Sub
 

fransvlaarhoven

Active Member
Licensed User
Longtime User
Hallo,

i'm attempting to make a device manager working on android version 5.1.1

Disabling the camera works but setting the maximum failed password before wipe seems to fail.

I'm using the code as found here at #23

Dim numberOfFailedPasswords As Int= 4
r.Target = manager
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"))

however, it seems to be that nothing happens when entering the wrong pincode

Can you help me out?

Thanks


Edit: found the solution. It seems to be the same problem as described in described in #21
 
Last edited:

khosrwb

Active Member
Licensed User
Longtime User
hi
when I run the sample
I get to under this error and when I prss listpermission button , show me : application does not any permission
 

Attachments

  • main.PNG
    153 KB · Views: 296
  • permission.PNG
    157.6 KB · Views: 296
  • manifest.PNG
    60.2 KB · Views: 296

khosrwb

Active Member
Licensed User
Longtime User
how can I change permission ,
I need to this permission : lock the screen
I will make only lock ((turn off screen))
 

Attachments

  • Screenshot_2015-12-20-17-03-32.jpg
    297.2 KB · Views: 294

peacemaker

Expert
Licensed User
Longtime User
Can Admin app install other new APK ?
 

manuel-r

Member
Licensed User
Longtime User
Hi.
Is it possible to set a new password/pin and lock the device if an app with admin-privilegs is uninstalled or if the privilegs are taken away?
 

manuel-r

Member
Licensed User
Longtime User
No. You cannot use any of the administrator features in that case.
Ok ... or not
So I have to write one app that runs a service that checks if an app is still installed and if not lock the device?!
Is there any way to hide an installed app? BTW: What happens if I give an app a very small transparent applogo and no name?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

manuel-r

Member
Licensed User
Longtime User
At this time I don't use the library but I think about it to prevent removing apps and company-apps that my users (our employees) don't like
If I could lock their devices in case of removing an app they have to come to me for unlocking.
As a kind of education. You know?
 

jazzzzzzz

Active Member
Licensed User
Longtime User
How can I use this lib to wake my app from lockscreen ? Provided phone does not use password protected lockscreen..
 

jazzzzzzz

Active Member
Licensed User
Longtime User
i have a sticky service running in my app,And in a particular condition i want to show my app screen even if the phone is locked(display offed state)
 

echapeta

Member
Licensed User
Longtime User
Hello,

I can compile and run the ezample, but when I try to use the library at an existing project I get the following compilation error:

AndroidManifest.xml:111: error: Error: No resource found that matches the given name (at 'resource' with value '@xml/device_admin').

The manifest line is:


'**************** Administrator Library
AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminManager$AdminReceiver"
androidermission="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>)


Can you help me ?

Thank You
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…