Sub Activity_Click
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim KeyguardManager As JavaObject = ctxt.RunMethod("getSystemService", Array("keyguard"))
Dim in As Intent = KeyguardManager.RunMethod("createConfirmDeviceCredentialIntent", Array("Title", "Description"))
If in.IsInitialized = False Then
Log("No password set!")
Return
End If
StartActivityForResult(in)
End Sub
Sub StartActivityForResult(i As Intent)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null) 'ion is a process global object: Private ion As Object
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
Sub GetBA As Object
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetField("processBA")
End Sub
Sub ion_Event (MethodName As String, Args() As Object) As Object
If Args(0) = -1 Then 'resultCode = RESULT_OK
Log("User unlocked successfully!")
End If
Return Null
End Sub