Class Platform2
- java.lang.Object
-
- com.clover.sdk.util.Platform2
-
public final class Platform2 extends Object
This class provides basic information about the Clover device on which the app is currently running.This class is a replacement for the com.clover.sdk.util.Platform class. The previous class required applications to be recompiled with the latest version for each new device release. This class will function properly on future devices. In some cases this class may be a near drop-in replacement for the old Platform class.
Some features have been removed compared to the previous class. In particular the Feature.BATTERY was unclear since devices such as Station 2018 which can function for a limited time on battery power but lack certain abilities such as ethernet and printing when running on battery.
It is recommended you read https://developer.android.com/guide/practices/compatibility for more information about developing compatible apps. However please be aware that Clover devices are technically not "Android Compatible" since they are not CTS qualified; though we strive to make them as compatible as possible. Clover devices do not have the Google Play Store, Google APIs or Google services.
Here are some additional links that may help when developing compatible apps:
- Screen size:
Configuration.screenLayout
orConfiguration.smallestScreenWidthDp
- API level:
Build.VERSION.SDK_INT
- Battery state:
PowerManager
- Screen size:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Platform2.Feature
List of features that may be present on Clover devices.static class
Platform2.Orientation
-
Field Summary
Fields Modifier and Type Field Description static float
CLOSE_TO_SQUARE_ASPECT_RATIO
If the ratio of the the largest screen dimension to the smallest screen dimension is less or equal to this value then we consider the display to be "square".
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Platform2.Orientation
defaultOrientation(Context context)
Get the default orientation under which this device is normally used, for the default display.static boolean
isClover()
Returns true when running on Clover hardware.static boolean
isSquareDisplay(Context context)
Answer if this device's default display is "square".static boolean
supportsFeature(Context context, Platform2.Feature f)
Return true if the specified feature is supported on this device.
-
-
-
Field Detail
-
CLOSE_TO_SQUARE_ASPECT_RATIO
public static final float CLOSE_TO_SQUARE_ASPECT_RATIO
If the ratio of the the largest screen dimension to the smallest screen dimension is less or equal to this value then we consider the display to be "square".- See Also:
- Constant Field Values
-
-
Method Detail
-
isClover
public static boolean isClover()
Returns true when running on Clover hardware.
-
supportsFeature
public static boolean supportsFeature(Context context, Platform2.Feature f)
Return true if the specified feature is supported on this device.
-
defaultOrientation
public static Platform2.Orientation defaultOrientation(Context context)
Get the default orientation under which this device is normally used, for the default display. This method does not return the current orientation!
-
isSquareDisplay
public static boolean isSquareDisplay(Context context)
Answer if this device's default display is "square". A display is square if the ratio of it's largest to smallest screen dimension isCLOSE_TO_SQUARE_ASPECT_RATIO
or less. Applications should avoid changing the screen orientation (e.g. by callingActivity.setRequestedOrientation(int)
) when running on square displays. The results of doing so are not well defined. Android has no official "square" screen orientation. On square displays,defaultOrientation(Context)
may return eitherPlatform2.Orientation.LANDSCAPE
orPlatform2.Orientation.PORTRAIT
.
-
-