shreyashghag / KioskModeAndroidExample

This is an basic example how can you run an Android App in Kiosk Mode.i.e only your app would run on the device and also you cannot exit the app till to disable kiosk mode.
12 stars 3 forks source link

Error: Unknown admin #1

Closed OmegaXhunter closed 2 years ago

OmegaXhunter commented 3 years ago

Hi, I cloned your repository and successfuly compiled it and run in an emulator.

The problem is when running the ADB command, I get this as response:

Error: Unknown admin: ComponentInfo{com.android.kioskmode/com.android.kioskmode.AdminReceiver}

Any ideas?

lainz commented 3 years ago

Same here

OmegaXhunter commented 3 years ago

Hi, I don't know what exactly was not working, but I've used the demo here https://snow.dog/blog/kiosk-mode-android

And it works. The code is a bit different, so maybe you can update your demo if you want, if not no problem =)

shreyashghag commented 3 years ago

Hi, I cloned your repository and successfuly compiled it and run in an emulator.

The problem is when running the ADB command, I get this as response:

Error: Unknown admin: ComponentInfo{com.android.kioskmode/com.android.kioskmode.AdminReceiver}

Any ideas? That is beacuse theres already a gmail account link to the device and if you want to make your app as admin there should be no google account linked to the device.

factory reset your device and then try writing the command through the ADB command it should work. Once you make it an admin app you cannot uninstall it directly you will have to remove the admin access for this app via the abd command again and then only you would be able to uninstall the app.

OmegaXhunter commented 3 years ago

Yes I did factory reset previously to test your app.

As I already said, it works now with the link I provided.

Thanks for your help.

kotta518 commented 2 years ago

Getting same error even after factory reset, any suggestions?

shreyashghag commented 2 years ago

@kotta518 did you add the receiver's code in the manifest file and also the XML file for device admin

kotta518 commented 2 years ago

yes, those are there as is in this sample.

<receiver android:name=".AdminReceiver" android:label="@string/app_name" android:permission="android.permission.BIND_DEVICE_ADMIN">