Android Question Device Owner / TaskLock - GetApplicationIntent after Locking terminal

mmanso

Active Member
Licensed User
Longtime User
Hi There,

I've created an application that will work on kiosks following this guide:


The application has a screen with two buttons:

  • Lock
  • Start API Server
On the start API Server, I've this code:

B4X:
    Dim pm As PackageManager
    Dim in As Intent
    in = pm.GetApplicationIntent("org.myapp.api")

    If in.IsInitialized Then
        StartActivity(in)
    End If

What's happening is that after I press the Lock button (and Android gets locked, no back buttons, no close application) I can't start the other application I also need to start.

Isn't this possible? Opening an application after the device has been Pinned?

Thanks in advance.
 

coderpenguen

New Member
I have completed all the methods but there is a problem. I have been working on this problem for 3 days. I may not have understood the working logic.
When I click the app lock button it gives this error. Please help.



B4X:
AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
  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>)
CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
  <limit-password />
  <reset-password />
  <force-lock />
  </uses-policies>
</device-admin>
)

ERROR

(AdminManager) anywheresoftware.b4a.objects.AdminManager@622cfe5
main_getmanager (java line: 443)
java.lang.RuntimeException: Field: dm not found in: anywheresoftware.b4a.objects.AdminManager
at anywheresoftware.b4j.object.JavaObject$FieldCache.getField(JavaObject.java:307)
at anywheresoftware.b4j.object.JavaObject.GetField(JavaObject.java:182)
at anywheresoftware.b4j.object.JavaObject.GetFieldJO(JavaObject.java:189)
at kiosk.otokiosk.main._getmanager(main.java:443)
at kiosk.otokiosk.main._btnlock_click(main.java:385)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
at android.widget.TextView.performClick(TextView.java:16222)
at android.view.View.performClickInternal(View.java:8137)
at android.view.View.access$3700(View.java:888)
at android.view.View$PerformClick.run(View.java:30236)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
 
Upvote 0
Top