Florian Aleman
Nov 14, 2017
4:59 pm

Problems with KioskMode.getInstance(context).disableKioskMode()

Hi,

I'm using the standard Knox SDK. My issues are about disableKioskMode():

- First issue : the call to that function stops my application (I wouldn't want to but it's fine) . The problem is : I can't restart it by code; even though i listen to KioskMode.ACTION_DISABLE_KIOSK_MODE. Actually, it seems that I never receive this event. And fyi, it works perfectly when I use enableKioskMode() and listen to KioskMode.ACTION_ENABLE_KIOSK_MODE.

- Second : when the app stops ( after using disableKioskMode() ), the tablet (Galaxy Tab S SM-T800) opens a tab on the right (Contacts, Dropbox, Email, Galaxy Apps, Galery, Internet..). Why ? And what can I do so it doesn't happen ?

http://imageshack.com/a/img924/1190/b5oZi2.png

Thank you 

Florian

Updated: Nov 14, 2017 5:00 pm

Similar topics

No similar topics found.
Samuel G.Samsung SEAP Moderator
Nov 14, 2017
7:03 pm

Hi Florian,

Could you please ensure that you're listening for the correct action in the manifest? The action for disabling KioskMode is edm.intent.action.disable.kiosk.mode.result. I've been able to receive this action on prelimenary tests.

Thanks,

Sam

Florian Aleman
Nov 15, 2017
7:38 am

Hi Sam, 

Thank you for your quick reply.

I think I have everything that is needed : 

<receiver android:name=".MyKioskReceiver" >
    <intent-filter>
        <action android:name="edm.intent.action.disable.kiosk.mode.result" />
        <action android:name="edm.intent.action.enable.kiosk.mode.result" />
    </intent-filter>
</receiver>

Florian

 

Comments

Could you let me know the model, build number, and Knox version of the device you're using?

Samuel G.Nov 15, 2017 at 5:44 pm
Florian Aleman
Nov 17, 2017
8:41 am

Hi Sam,

Model : SM-T810

Build number : NRD90M.T810XXU2DQI6

Knox version : 2.7.1 
Standard SDK : 5.7.1
Premium SDK : 2.7.1
Custom SDK : 2.7.1
Container : 2.7.1
CEP : 2.1.1
OTP : 2.6.0
SE : 2.4.3
SS : 2.5.0
Share Device : 2.6.0
TIMA : 3.3.005
VPN : 2.3.0

@Override
public void onReceive(Context context, Intent intent)
{
    if (intent != null)
    {
        String action = intent.getAction();
        if (action == null)
        {
            return;
        }
        else if (action.equals(KioskMode.ACTION_ENABLE_KIOSK_MODE_RESULT))
        {
            getEDM(context).getApplicationPolicy().deleteHomeShortcut(packageName, null);
            getEDM(context).getApplicationPolicy().addHomeShortcut(packageName, null);
            restartApp(context);
        }

        else if (action.equals(KioskMode.ACTION_DISABLE_KIOSK_MODE_RESULT))
        {
            getEDM(context).getApplicationPolicy().deleteHomeShortcut(packageName, null);
            restartApp(context);
        }
    }
}

Florian

Updated: Nov 17, 2017 at 8:42 am

Florian Aleman
Nov 21, 2017
8:05 am

Hi, just to keep this thread up.

Florian

Samuel G.Samsung SEAP Moderator
Nov 22, 2017
10:13 pm

Hi Florian,

I'm about to send you an APK file to your email. Could you please go through the buttons from top to bottom, and let me know whether or not you get the toast messages saying the actions were received, and if the menu still appears once kiosk mode is disabled?

Thanks,

Sam

Florian Aleman
Nov 23, 2017
10:10 am

Hi  Sam,

I tested your apk, and everything works fine. I get the toasts messages and the app restart just after stop kioskMode.

Florian

Florian Aleman
Nov 24, 2017
9:37 am

Hi Sam,

After some digging, I found what my problem was : I used to remove the AdminAdministrator before being able to receive the ACTION_DISABLE_KIOSK_MODE. So I just moved the code for removing AdminAdministrator after receiving the event and it works now.

ApplicationPolicy ap = new EnterpriseDeviceManager(context).getApplicationPolicy();
if (intent.getAction() == KioskMode.ACTION_ENABLE_KIOSK_MODE_RESULT)
{
    ap.addHomeShortcut(context.getPackageName(), null);
    restartApp(context);
}
else if (intent.getAction() == KioskMode.ACTION_DISABLE_KIOSK_MODE_RESULT)
{
    ap.deleteHomeShortcut(context.getPackageName(), null);
    getDPM(context).removeActiveAdmin(getDA(context));
    restartApp(context);
}

However, with the other tablet (SM-T800) , I still get the tab that opens (http://imageshack.com/a/img924/1190/b5oZi2.png). If you have any idea ;)

Thanks

Florian

 

 

Samuel G.Samsung SEAP Moderator
Nov 24, 2017
5:07 pm

Hi Florian,

What I did in my app was in the if-block for Kiosk disable, I opened the app by intent (startActivity(Intent)). Perhaps you can try this method?

Thanks,
Sam