Android Question Error when creating kiosk app

bdunkleysmith

Active Member
Licensed User
Longtime User
At the suggestion of DonManfred in this post I am trying to make a kiosk app. Following the instructions in Device Owner / TaskLock / Kiosk apps 2017 I have created the app, including addition of the listed code in the manifest editor and run it on the device in Release mode.

However after connecting the device to my PC in USB debug mode and running the command described at step 2, I receive the following error:

c:\Android\android-sdk\platform-tools>adb shell set-device-owner b4a.foxtelremotes/anywheresoftware.b4a.objects.AdminReceiver2
adb server version (40) doesn't match this client (39); killing...
* daemon started successfully *
/system/bin/sh: set-device-owner: not found

How do I fix the mismatch in server and client versions?

In addition I have two further questions:

  1. At the end of step 2 before step 3 it says
    Existing user accounts on the device must first be removed (Settings - Accounts).
    Does this really mean I need to remove the one account I created originally to set the device up, including downloading B4A Bridge from the Play Store? Or does it mean remove any additional accounts that may have been created subsequent to the original (owner) account being created?

  2. Once I have the app running in kiosk mode, how do I gain access to the device in case I want to update my kiosk app or perform any other maintenance, updates, etc. on the device?
Thanks in anticipation of any assistance.
 

DonManfred

Expert
Licensed User
Longtime User
You are using the B4A SDKManager and have all Items Updated?
You are using android.jar from Api 28?
You are running it on a Device with Android 5+?
What is the path you are using in the B4A SDKManager for the sdkmanager.bat?
 
Last edited:
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
Thanks DonManfred for the guidance of where to check.

You are using the B4A SDKManager and have all Items Updated?

Yes, but when using B4A SDKManager to ensure all updates were installed I received this error:

SDKManager Error.png

and so I ran C:\Android\android-sdk\SDK Manager.exe directly.

Even after performing that update I still get the above error, but I pushed on . .

You are using android.jar from Api 28?

Yes

You are running it on a Device with Android 5+?

Yes, 5.1.1

What is the path you are using in the B4A SDKManager for the sdkmanager.bat?

As above, C:\Android\android-sdk\SDK Manager.exe

I was running jdk1.8.0_121 and so updated that to jdk1.8.0_191.

After that I tried again and received the following error

c:\Android\android-sdk\platform-tools>adb shell dpm set-device-owner b4a.foxtelremotes/anywheresoftware.b4a.objects.AdminReceiver2
java.lang.IllegalStateException: Trying to set device owner but device is already provisioned.
at android.os.Parcel.readException(Parcel.java:1554)
at android.os.Parcel.readException(Parcel.java:1499)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:4438)
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.dpm.Dpm.main(Dpm.java:38)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:255)

So that really answered my Question 1. Indeed all existing accounts need to be deleted. So I did and voila . . .

c:\Android\android-sdk\platform-tools>adb shell dpm set-device-owner b4a.foxtelremotes/anywheresoftware.b4a.objects.AdminReceiver2
Success: Device owner set to package b4a.foxtelremotes
Active admin set to component {b4a.foxtelremotes/anywheresoftware.b4a.objects.AdminReceiver2}

The app appears at boot up as desired and the user is unable to do anything but use the app provided.

So that brings me to my Question 2. Now I have the app running in kiosk mode, how do I gain access to the device in case I want to update the kiosk app or perform any other maintenance, updates, etc. on the device?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
and so I ran C:\Android\android-sdk\SDK Manager.exe directly.
This is the mistake. Do not use the old tools anymore. Even noch the old SDK.

You can find the Setup-Instructions here. https://www.b4x.com/b4a.html
You also can watch this Video as it describes it clearly.

Start with a new Blank folder for the SDK like you see in the Video.
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
Thanks again Manfred. I have created a fresh C:\Android\ and followed the instructions. No errors running the B4A SDKManager now!

As I mentioned above, even before doing that I achieved my app running as a kiosk app and I'm very happy.

Unfortunately I made the mistake of not including a "hidden" means of unlocking the kiosk app so that I could update it after making some minor mods to the B4A code - a trap for newbies!

So I had to do a factory reset on the device and reinstall the app after including code to lock/unlock it. The code is based on Erel's example in Device Owner / TaskLock / Kiosk apps 2017.

The only shortcoming is that when the device is powered up the usual Android home screen appears before the kiosk app starts and locks out access to all other resources. Perhaps I changed something while implementing the lock/unlock code as I didn't think this happened when I first installed the kiosk app - I seem to recall that the device booted straight to the app without the home screen showing. Perhaps it's not set as a home launcher activity even though I have the appropriate code in the manifest editor. But it's not a problem for my current purpose.

Here is the UI:

Screenshot.png

This Android app - a large button remote control of a Foxtel (Australian pay TV) box - is used in conjunction with my Bluetooth to IR repeater referenced here How to create new or update rIRremote library.
 
Last edited:
Upvote 0
Top