Class NativeSetting

All Implemented Interfaces:
IOpenNativeSettings, EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable

public class NativeSetting extends PropCnr implements IOpenNativeSettings
This Flashlight or torch property is a container that holds information about client devices flashlight availability, state and intensity. The flashlight is only present with the iiziRun Cordova hybrid client. The intensity is currently only working with iOS.
Author:
Christopher Mindus
  • Constructor Details

    • NativeSetting

      public NativeSetting()
      Creates the flashlight properties without a name.
    • NativeSetting

      public NativeSetting(Atom atom)
      Creates the flashlight properties with a name.
      Parameters:
      atom - The atom name.
  • Method Details

    • onPropDispose

      protected void onPropDispose()
      Called when a property is disposed of by delete/remove in a container, or by the dispose method.

      The Property Container clears the structure of unsent communication requests to clear memory.

      This call is done just at the end of the delete/remove routine in the container, without synchronization.

      During this call, whatever components that e.g. the client needs to disposed of is done.

      Subclasses needing to perform some intelligent operations upon deletion should do it by overloading this method and always call the super.onPropDispose() method.

      Overrides:
      onPropDispose in class PropCnr
    • clone

      public NativeSetting clone()
      Clones the properties.
      Overrides:
      clone in class PropCnr
    • isSupported

      public boolean isSupported()
      Checks if this client supports any native settings or not.
      Specified by:
      isSupported in interface IOpenNativeSettings
      Returns:
      true if client is Android or iOS running iiziRun, false otherwise (e.g. browser or PWA).
    • isClient_Android

      public boolean isClient_Android()
      Checks if the client is Android.
      Specified by:
      isClient_Android in interface IOpenNativeSettings
      Returns:
      true if client is Android running iiziRun, false otherwise (e.g. browser or PWA).
    • isClient_iOS

      public boolean isClient_iOS()
      Checks if the client is iOS.
      Specified by:
      isClient_iOS in interface IOpenNativeSettings
      Returns:
      true if client is iOS running iiziRun, false otherwise (e.g. browser or PWA).
    • isReady

      public 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 to openNativeSettings(INativeSetting, IOpenSettingSuccess, IOpenSettingFailure) will succeed.
      Specified by:
      isReady in interface IOpenNativeSettings
      Returns:
      true if the client supports opening a setting and that it is not busy, disconnected or not available to process requests.
    • openNativeSettings

      public boolean openNativeSettings(INativeSetting setting, IOpenSettingSuccess success, IOpenSettingFailure failure)
      Opens a native setting on the client. The success and failure 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 either success or failure functions are null, it is accepted and just ignored by the API.
      Specified by:
      openNativeSettings in interface IOpenNativeSettings
      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 is false, a potential failure callback will be invoked prior to returning, in the same thread.
      Throws:
      NullPointerException - If the setting is null.
      IllegalArgumentException - If the setting is not valid for the client device in question.
    • getClientSession

      public IClientSessionGyro getClientSession()
      Gets the client session associated with this flashlight instance.
      Specified by:
      getClientSession in interface IOpenNativeSettings
      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.
    • onRemoteEvent

      public void onRemoteEvent(RemoteEvent event)
      Called when a remote property event should be processed by this property.
      Specified by:
      onRemoteEvent in interface IGProp<GProp<?>[]>
      Overrides:
      onRemoteEvent in class GProp<GProp<?>[]>
      Parameters:
      event - The remote event.