Package com.iizix.device.settings
Interface IOpenNativeSettings
- All Known Implementing Classes:
NativeSetting
public interface IOpenNativeSettings
Interface used to open native device settings when the client is iiziRun based.
The device settings opens native Android or iOS settings. This interface is only present on the Hybrid iiziRun based client (Cordova based) and is not available for other client types such as pure browser or Progressive Web Apps (PWA).
This interface is retrieved from the client session using IClientSessionGyro.getOpenNativeSettings()
. The native setting is opened with the method #openNativeSettings(INativeSetting, java.util.function.BiConsumer, java.util.function.BiConsumer)
.
See cordova-open-native-settings of the implementation in Cordova for more information.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final IOpenNativeSettings
Default instance that always returns unsupported and not Android nor iOS client, and throws IllegalArgumentException when attempting to open a setting.Method Summary
Modifier and TypeMethodDescriptionGets the client session associated with this flashlight instance.boolean
Checks if the client is Android.boolean
Checks if the client is iOS.boolean
isReady()
Verifies if this instance is ready to accept an open native settings call.boolean
Checks if this client supports any native settings or not.boolean
openNativeSettings
(INativeSetting setting, IOpenSettingSuccess success, IOpenSettingFailure failure) Opens a native setting on the client.
Field Details
DEFAULT_IMPL
Default instance that always returns unsupported and not Android nor iOS client, and throws IllegalArgumentException when attempting to open a setting.
Method Details
isSupported
boolean isSupported()Checks if this client supports any native settings or not.- Returns:
true
if client is Android or iOS running iiziRun,false
otherwise (e.g. browser or PWA).
isClient_Android
boolean isClient_Android()Checks if the client is Android.- Returns:
true
if client is Android running iiziRun,false
otherwise (e.g. browser or PWA).
isClient_iOS
boolean isClient_iOS()Checks if the client is iOS.- Returns:
true
if client is iOS running iiziRun,false
otherwise (e.g. browser or PWA).
isReady
boolean isReady()Verifies if this instance is ready to accept an open native settings call. Please note that it is not guaranteed due to threading that the call toopenNativeSettings(INativeSetting, IOpenSettingSuccess, IOpenSettingFailure)
will succeed.- Returns:
true
if the client supports opening a setting and that it is not busy, disconnected or not available to process requests.
getClientSession
IClientSessionGyro getClientSession()Gets the client session associated with this flashlight instance.- Returns:
- The client session, or
null
if it is disposed of already. Please note that the client session might be returned as non-null but that it is currently in dispose operation.
openNativeSettings
boolean openNativeSettings(INativeSetting setting, IOpenSettingSuccess success, IOpenSettingFailure failure) Opens a native setting on the client. Thesuccess
andfailure
parameters can be specified as a callbacks that receives two parameters: the client session that was the target of the open native setting, and the setting requested for the open operation. If eithersuccess
orfailure
functions arenull
, it is accepted and just ignored by the API.- Parameters:
setting
- The setting to open.success
- Success callback function,null
for none (ignored).failure
- Failure callback function,null
for none (ignored).- Returns:
- Flag for successful request issued. When
true
, the callbacks (if defined) will be invoked at a later stage. If the request fails immediately and this return code isfalse
, a potentialfailure
callback will be invoked prior to returning, in the same thread. - Throws:
NullPointerException
- If thesetting
isnull
.IllegalArgumentException
- If thesetting
is not valid for the client device in question.