Tomasz Zakrzewski
Apr 16, 2018
9:53 am

Recent button in ProKioskMode

Hello

I have problem to enable recent button in ProKioskMode. I have set:

1) enable ProKioskMode:

pkm.setProKioskState(true, "12345");

2)
kioskModeService.allowTaskManager(true);

List<Integer> availableHwKeys = new ArrayList<>();
availableHwKeys.add(KeyEvent.KEYCODE_APP_SWITCH);
kioskModeService.allowHardwareKeys(availableHwKeys, true);

But button is not working.

b.r.

Updated: Apr 16, 2018 9:53 am

Similar topics

No similar topics found.
Kamil K.Samsung SEAP Moderator
Apr 17, 2018
8:34 am

Hello Tomasz,

It is not posible to enable recent apps button when Pro Kiosk is set. Basically Pro Kiosk is supposed to be used with single application.

Best regards

Comments

Thanks for response. It's any way to handle this button and create own one recent app?

Or will explain our company needs, maybe kiosk mode is not what we want.

We need to lock access to settings, all quick menu items except wifi, show only gallery, camera and our app on phone desktop. It's like kiosk mode but with access to wifi. My best fit was ProKiosk mode (used own custom launcher) but only missing recent app functionality. Maybe exist other way to do it? Without kiosk mode?

b.r.

Tomasz ZakrzewskiApr 17, 2018 at 10:09 am

if you want to use ProKiosk you may use below reflection method to open recent apps on devices with OS below Oreo.

Class serviceManagerClass = Class.forName("android.os.ServiceManager");
Method getService = serviceManagerClass.getMethod("getService", String.class);
IBinder retbinder = (IBinder) getService.invoke(serviceManagerClass, "statusbar");
Class statusBarClass = Class.forName(retbinder.getInterfaceDescriptor());
Object statusBarObject = statusBarClass.getClasses()[0].getMethod("asInterface", IBinder.class).invoke(null, new Object[]{retbinder});
Method toggleRecentApps = statusBarClass.getMethod("toggleRecentApps");
toggleRecentApps.setAccessible(true);
toggleRecentApps.invoke(statusBarObject);

Also it is possible to use Accessibility service (inject below call) for this purpose with no OS version limitation. However it is not possible to turn on Accessibility service automatically so the user need to do this manually before ProKiosk is enabled (access to settings is required)

performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS);

Alternatively you can use KioskMode which is not disabling recent apps button by default.

Kamil K.Apr 19, 2018 at 3:02 pm