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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if Bluetooth is enabled on the device.boolean
Checks if the device is connected to any (public or local) Network.boolean
Checks if the App is on foreground.boolean
Checks if the device is connected to the internet.boolean
Checks if the device screen is interactive.boolean
Checks 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:
true
if 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:
true
if Screen is interactive
-
isConnectedToInternet
@RequiresPermission("android.permission.ACCESS_NETWORK_STATE") public boolean isConnectedToInternet()Checks if the device is connected to the internet.- Returns:
true
if 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:
true
if connected to any Network
-
bluetoothIsEnabled
@RequiresPermission("android.permission.BLUETOOTH") public boolean bluetoothIsEnabled()Checks if Bluetooth is enabled on the device.Note: Requires
Manifest.permission.BLUETOOTH
permission.- Returns:
true
if 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_LOCATION
permission.- Returns:
true
if Location is enabled
-