Package com.blukii.sdk.common
Class FeatureValidator
java.lang.Object
com.blukii.sdk.common.FeatureValidator
Helper class to validate application and mobile device features.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if Bluetooth is enabled on the device.booleanChecks if the device is connected to any (public or local) Network.booleanChecks if the App is on foreground.booleanChecks if the device is connected to the internet.booleanChecks if the device screen is interactive.booleanChecks if Location is enabled on the device.
-
Constructor Details
-
FeatureValidator
public FeatureValidator(@NonNull android.content.Context context) Constructor- Parameters:
context- a valid context that must not be null
-
-
Method Details
-
isAppOnForeground
public boolean isAppOnForeground()Checks if the App is on foreground.- Returns:
trueif App is on foreground
-
isScreenOn
public boolean isScreenOn()Checks if the device screen is interactive.Note: if the device is on lock screen this function will return
false- Returns:
trueif Screen is interactive
-
isConnectedToInternet
@RequiresPermission("android.permission.ACCESS_NETWORK_STATE") public boolean isConnectedToInternet()Checks if the device is connected to the internet.- Returns:
trueif connected to the internet
-
hasNetworkConnection
@RequiresPermission("android.permission.ACCESS_NETWORK_STATE") public boolean hasNetworkConnection()Checks if the device is connected to any (public or local) Network.- Returns:
trueif connected to any Network
-
bluetoothIsEnabled
@RequiresPermission("android.permission.BLUETOOTH") public boolean bluetoothIsEnabled()Checks if Bluetooth is enabled on the device.Note: Requires
Manifest.permission.BLUETOOTHpermission.- Returns:
trueif Bluetooth is enabled
-
locationIsEnabled
@RequiresPermission("android.permission.ACCESS_FINE_LOCATION") public boolean locationIsEnabled()Checks if Location is enabled on the device.Note: Requires
Manifest.permission.ACCESS_FINE_LOCATIONpermission.- Returns:
trueif Location is enabled
-