Hierarchy

  • ApplicationAndroidProps

Properties

locale: string

Set/Get the layout direction from a Locale.

Property

Android

Since

3.1.3

getLayoutDirection: LayoutDirection

Get current layout direction.

Property

Android

Since

3.1.3

packageName: string

Application package name.

Property

Android

Since

0.1

shouldShowRequestPermissionRationale: ((permission: string) => boolean)

Type declaration

    • (permission: string): boolean
    • This method checks for a permission is shown before to user and the program is about to request the same permission again

      Method

      shouldShowRequestPermissionRationale

      Returns

      Android

      Since

      1.2

      Parameters

      • permission: string

      Returns boolean

navigationBar?: Navigationbar

This lets you determine the navigation bar of the phone(the bar which usually has native back button and app switch) Works for Android 8.0 and above. Some phones might not have this.

checkPermission: ((permission: string) => boolean)

Type declaration

    • (permission: string): boolean
    • This function checks if one of the dangerous permissions is granted at beginning or not. For android versions earlier than 6.0, it will return value exists in manifest or not. For permissions in same category with one of the permissions is approved earlier, checking will return as it is not required to request for the same category permission.

      Method

      checkPermission

      Returns

      Android

      Since

      1.2

      Parameters

      • permission: string

      Returns boolean

requestPermissions: ((requestIdentifier: number, permission: string) => void)

Type declaration

    • (requestIdentifier: number, permission: string): void
    • With requestPermissions, the System Dialog will appear to ask for permission grant by user for dangerous(privacy) permissions. Application.android#onRequestPermissionsResult onRequestPermissionsResult will be fired after user interact with permission dialog.

      Example

      import Application from '@smartface/native/application';
      const PERMISSION_CODE = 1002;
      Application.android.requestPermissions(PERMISSION_CODE, Application.Android.Permissions.WRITE_EXTERNAL_STORAGE)
      Application.android.onRequestPermissionsResult = (e) => {
      console.log(JSON.stringify(e));
      }

      Method

      requestPermissions

      Android

      Since

      1.2

      Parameters

      • requestIdentifier: number

        This number will be returned in Application.android.onRequestPermissionsResult onRequestPermissionsResult when the user give permission or not.

      • permission: string

      Returns void

keyboardMode: KeyboardMode
setAppTheme: ((theme: string) => void)

Type declaration

    • (theme: string): void
    • Set the configure the native theme.

      Method

      setAppTheme

      Android

      Since

      4.0.2

      Parameters

      • theme: string

      Returns void

Events

onBackButtonPressed: (() => void)

Type declaration

    • (): void
    • Triggered when user press back key. The default implementation finishes the application, but you can override this to do whatever you want.

      onBackButtonPressed

      Android

      Deprecated

      Since

      3.2.0

      Example

      import Application from '@smartface/native/application';

      Application.on(Application.Events.backButtonPressed, () => {
      console.info('onBackButtonPressed');
      });

      Returns void

dispatchTouchEvent: (() => boolean)

Type declaration

    • (): boolean
    • Called to process touch screen events. You can assign callback to intercept all touch screen events before they are dispatched to the window (except independent windows like dialog and etc.). Be sure to call this implementation for touch screen events that should be handled normally. Callback might be fired several times.

      Example

      import Application from '@smartface/native/application';
      Application.android.dispatchTouchEvent = () => {
      return true; //Consume all touches & do not pass to window
      }

      @event dispatchTouchEvent

      Android

      Returns

      Since

      4.0.3

      Returns boolean

onRequestPermissionsResult: ((e: { requestCode: number; result: boolean | boolean[] }) => void)

Type declaration

    • (e: { requestCode: number; result: boolean | boolean[] }): void
    • This event is called after Application.requestPermissions function. This event is fired asynchronous way, there is no way to make sure which request is answered.

      Since

      1.2 onRequestPermissionsResult

      Android

      Deprecated

      Use Permissions.android.onRequestPermissionsResult instead

      Since

      1.2

      Parameters

      • e: { requestCode: number; result: boolean | boolean[] }
        • requestCode: number
        • result: boolean | boolean[]

          Will return array if permission request is multiple.

      Returns void

Generated using TypeDoc