question

mybmr avatar image
mybmr asked bryanvargas answered

How to implement fully KIOSK mode ?

I'm developing an app with Clover device right now in SANDBOX environment. The idea is to finalise the APP as a Self Service Payment Application (to use Clover MINI device as a self service KIOSK). So user can not able to leave application.

I tried to hide bottom and top control bar. But still I can able leave application. I also preferred below post but can't able to find example for CustomerMode class in the SDK.

https://community.clover.com/questions/10829/clover-mini-app-in-kiosk-mode.html



Clover Android SDK
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
bryanvargas avatar image
bryanvargas answered

Here is an example:


 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        CustomerMode.enable(this); // This is turning on Customer Mode


        // Below is checking if CustomerMode is on Primary Display
        // Please note that the CustomerMode SDK only works on Primary Display
        if (CustomerMode.isShownOnPrimaryDisplay(this) == true) {
            System.out.println("On Primary Display!!");
            Intent intent = new Intent("clover.intent.action.CUSTOMER_MODE");
            CustomerMode.getStateFromIntent(intent);
            CustomerMode.getState(this);
            System.out.println(intent);
            System.out.println("Customer Mode State " + CustomerMode.getState(this));
        } else {
            System.out.println("Not on Primary Display!!");
            finish();
        }
    }


    @Override
    protected void onStart() {
        super.onStart();
        // The lines below are the confirmation of the state of CustomerMode.
        // If CustomerMode is DISABLED it will show you the state and
        // will system print out a note to turn on CustomerMode
        if (CustomerMode.getState(this) == State.DISABLED) {
            CustomerMode.getState(this).toString();
            System.out.println("The State is:" + CustomerMode.getState(this) + " please enable the Customer mode");
            CustomerMode.enable(this);
        } else {
            System.out.println("Customer Mode is successfully enabled");
        }
    }


    // Below is where you can add your own code integration to exit CustomerMode.
    // This is just an example, although, it doesn't do anything for now
    @Override
    public void finish() {
        if (CustomerMode.getState(this) == CustomerMode.State.ENABLED) {
            CustomerMode.disable(this, true);
        }
        super.finish();
    }
}
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community