Package com.clover.sdk.util
Class CustomerMode
- java.lang.Object
-
- com.clover.sdk.util.CustomerMode
-
public class CustomerMode extends Object
This class allows an app to check and update the state of customer mode. Customer mode is a feature available on Clover devices (except Station) that allows an activity run fullscreen on the primary display without the navigation bar or status bar and without the ability to do a gesture to bring them back. Customer mode also prevents the keyguard from appearing so customers cannot get stuck on the employee login screen.Unless you intend for all users of the device to be locked out of all other applications you should ensure that your application always has some way to exit customer mode so the operator (employees, manager, etc) can exit your app and manage the device.
Display Timeout
Customer mode doesn't prevent the display from timing out and becoming totally black. The default display timeout may be too short for a good customer experience. It may be prudent when using customer mode to additionally keep the display on longer while also considering the possibility of LCD burn-in if the display is showing the same content indefinitely.See this page for several techniques to keep the screen on programmatically.
Secondary Display Support
Activities running on secondary display of a multi-display device need not invoke the methods here since secondary display has no navigation bar or status bar and has no exit gestures by default. The enable and disable methods will attempt to detect if the passed context is an activity and if so will perform no action on a secondary display activity. The secondary display also has it's own display timeout mechanism that is intended for customer use.Original Station
If you are writing an application for the original Clover Station, this class won't function properly. Instead using the following code snippet to get Clover Station into customer mode.if (!Platform2.supportsFeature(context, Platform2.Feature.CUSTOMER_MODE)) { getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | 0x10000000); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CustomerMode.State
State of customer mode.
-
Field Summary
Fields Modifier and Type Field Description static String
ACTION_CUSTOMER_MODE
Broadcast Action: This is a sticky broadcast containing the customer mode state.static String
EXTRA_CUSTOMER_MODE_STATE
String extra with one of theCustomerMode.State
enum values.static int
WINDOW_FEATURE_CUSTOMER_MODE
Deprecated.static int
WINDOW_FEATURE_NO_CUSTOMER_MODE
Deprecated.
-
Constructor Summary
Constructors Constructor Description CustomerMode()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
disable(Activity activity)
Disable customer mode.static void
disable(Activity activity, boolean requireEmployeePasscode)
Disable customer mode.static void
disable(Context context)
Deprecated.static void
disable(Context context, boolean requireEmployeePasscode)
Deprecated.static void
enable(Activity activity)
Enable customer mode.static void
enable(Context context)
Deprecated.static CustomerMode.State
getState(Activity activity)
Returns the current state of customer mode.static CustomerMode.State
getState(Context context)
Deprecated.static CustomerMode.State
getStateFromIntent(Intent intent)
Return the current state of customer mode given theEXTRA_CUSTOMER_MODE_STATE
string that was obtained from aACTION_CUSTOMER_MODE
broadcast.static boolean
isShownOnPrimaryDisplay(Activity activity)
Returns true if the given activity is shown on the primary display of a device capable of entering customer mode.static void
registerReceiver(Activity activity, BroadcastReceiver customerModeReceiver)
Convenience method to register broadcast receiver of customer mode change.static void
unregisterReceiver(Activity activity, BroadcastReceiver customerModeReceiver)
Convenience method to unregister broadcast receiver of customer mode change.
-
-
-
Field Detail
-
ACTION_CUSTOMER_MODE
public static final String ACTION_CUSTOMER_MODE
Broadcast Action: This is a sticky broadcast containing the customer mode state. NOTE: this is a protected intent that can only be sent by the system.- See Also:
- Constant Field Values
-
EXTRA_CUSTOMER_MODE_STATE
public static final String EXTRA_CUSTOMER_MODE_STATE
String extra with one of theCustomerMode.State
enum values.- See Also:
- Constant Field Values
-
WINDOW_FEATURE_CUSTOMER_MODE
@Deprecated public static final int WINDOW_FEATURE_CUSTOMER_MODE
Deprecated.Deprecated. Most devices do not support this feature, supply your own user interface for entering and exiting customer mode instead.- See Also:
- Constant Field Values
-
WINDOW_FEATURE_NO_CUSTOMER_MODE
@Deprecated public static final int WINDOW_FEATURE_NO_CUSTOMER_MODE
Deprecated.Deprecated. Most devices do not support this feature, supply your own user interface for entering and exiting customer mode instead.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CustomerMode
@Deprecated public CustomerMode()
Deprecated.Instances of this class have never been necessary and do nothing, all methods and fields are static.
-
-
Method Detail
-
enable
@Deprecated public static void enable(Context context)
Deprecated.Enable customer mode. Hide the navigation bar and status bar on the primary display. This method has no effect if the passed context is an activity which is running on a non-primary display. Deprecated in favor ofenable(Activity)
.
-
enable
public static void enable(Activity activity)
Enable customer mode. Hide the navigation bar and status bar on the primary display. This method has no effect if the passed activity is running on a non-primary display.
-
disable
@Deprecated public static void disable(Context context)
Deprecated.Disable customer mode. Bring back the navigation bar and status bar on the primary display. This method has no effect if the passed context is an activity which is running on a non-primary display. Deprecated in favor ofdisable(Activity)
.
-
disable
public static void disable(Activity activity)
Disable customer mode. Bring back the navigation bar and status bar on the primary display. This method has no effect if the passed context is an activity which is running on a non-primary display.
-
disable
@Deprecated public static void disable(Context context, boolean requireEmployeePasscode)
Deprecated.Disable customer mode. Bring back the navigation bar and status bar on the primary display. Show the lockscreen and hide quick access button if requireEmployeePasscode is set to true. This method has no effect if the passed context is an activity which is running on a non-primary display. Deprecated in favor ofdisable(Activity, boolean)
.- Parameters:
requireEmployeePasscode
- true if you want to force the employee lockscreen to appear without the "default employee" option if the merchant has enabled "default employee".
-
disable
public static void disable(Activity activity, boolean requireEmployeePasscode)
Disable customer mode. Bring back the navigation bar and status bar on the primary display and show the lockscreen. This method has no effect if the passed context is an activity which is running on a non-primary display.- Parameters:
requireEmployeePasscode
- true if you want to force the employee lockscreen to appear without the "default employee" option if the merchant has enabled "default employee".
-
getState
@Deprecated public static CustomerMode.State getState(Context context)
Deprecated.Returns the current state of customer mode. If the passed context is an activity then it always returns DISABLED if the activity is running on the non-primary display. Deprecated in favor ofgetState(Activity)
.
-
getState
public static CustomerMode.State getState(Activity activity)
Returns the current state of customer mode. Always returns DISABLED if the passed activity is running on the non-primary display.
-
isShownOnPrimaryDisplay
public static boolean isShownOnPrimaryDisplay(Activity activity)
Returns true if the given activity is shown on the primary display of a device capable of entering customer mode. Must be called during or afterActivity.onCreate(Bundle)
. The value false indicates either the device does not support customer mode at all (such as the original Clover Station) or the activity is shown on secondary display.
-
getStateFromIntent
public static CustomerMode.State getStateFromIntent(Intent intent)
Return the current state of customer mode given theEXTRA_CUSTOMER_MODE_STATE
string that was obtained from aACTION_CUSTOMER_MODE
broadcast.
-
registerReceiver
public static void registerReceiver(Activity activity, BroadcastReceiver customerModeReceiver)
Convenience method to register broadcast receiver of customer mode change. This method has no effect if the passed context is an activity which is running on a non-primary display.
-
unregisterReceiver
public static void unregisterReceiver(Activity activity, BroadcastReceiver customerModeReceiver)
Convenience method to unregister broadcast receiver of customer mode change. This method has no effect if the passed context is an activity which is running on a non-primary display.
-
-