8.7 released—WinterCG Compliance Part 1
Learn more
AndroidApplication

Summary

Properties

activityBackPressedEvent
activityBackPressedEvent
activityCreatedEvent
activityCreatedEvent
activityDestroyedEvent
activityDestroyedEvent
activityNewIntentEvent
activityNewIntentEvent
activityPausedEvent
activityPausedEvent
activityRequestPermissionsEvent
activityRequestPermissionsEvent
activityResultEvent
activityResultEvent
activityResumedEvent
activityResumedEvent
activityStartedEvent
activityStartedEvent
activityStoppedEvent
activityStoppedEvent
saveActivityStateEvent
saveActivityStateEvent

Properties

activityBackPressedEvent

Readonly
activityBackPressedEvent: "activityBackPressed" = AndroidApplication.activityBackPressedEvent

activityCreatedEvent

Readonly
activityCreatedEvent: "activityCreated" = AndroidApplication.activityCreatedEvent

activityDestroyedEvent

Readonly
activityDestroyedEvent: "activityDestroyed" = AndroidApplication.activityDestroyedEvent

activityNewIntentEvent

Readonly
activityNewIntentEvent: "activityNewIntent" = AndroidApplication.activityNewIntentEvent

activityPausedEvent

Readonly
activityPausedEvent: "activityPaused" = AndroidApplication.activityPausedEvent

activityRequestPermissionsEvent

Readonly
activityRequestPermissionsEvent: "activityRequestPermissions" = AndroidApplication.activityRequestPermissionsEvent

activityResultEvent

Readonly
activityResultEvent: "activityResult" = AndroidApplication.activityResultEvent

activityResumedEvent

Readonly
activityResumedEvent: "activityResumed" = AndroidApplication.activityResumedEvent

activityStartedEvent

Readonly
activityStartedEvent: "activityStarted" = AndroidApplication.activityStartedEvent

activityStoppedEvent

Readonly
activityStoppedEvent: "activityStopped" = AndroidApplication.activityStoppedEvent

saveActivityStateEvent

Readonly
saveActivityStateEvent: "saveActivityState" = AndroidApplication.saveActivityStateEvent

activityBackPressedEvent

StaticReadonly
activityBackPressedEvent: "activityBackPressed" = 'activityBackPressed'

activityCreatedEvent

StaticReadonly
activityCreatedEvent: "activityCreated" = 'activityCreated'

activityDestroyedEvent

StaticReadonly
activityDestroyedEvent: "activityDestroyed" = 'activityDestroyed'

activityNewIntentEvent

StaticReadonly
activityNewIntentEvent: "activityNewIntent" = 'activityNewIntent'

activityPausedEvent

StaticReadonly
activityPausedEvent: "activityPaused" = 'activityPaused'

activityRequestPermissionsEvent

StaticReadonly
activityRequestPermissionsEvent: "activityRequestPermissions" = 'activityRequestPermissions'

activityResultEvent

StaticReadonly
activityResultEvent: "activityResult" = 'activityResult'

activityResumedEvent

StaticReadonly
activityResumedEvent: "activityResumed" = 'activityResumed'

activityStartedEvent

StaticReadonly
activityStartedEvent: "activityStarted" = 'activityStarted'

activityStoppedEvent

StaticReadonly
activityStoppedEvent: "activityStopped" = 'activityStopped'

saveActivityStateEvent

StaticReadonly
saveActivityStateEvent: "saveActivityState" = 'saveActivityState'

Accessors

backgrounded

get backgrounded(): boolean

context

get context(): Context

foregroundActivity

get foregroundActivity(): AppCompatActivity
The currently active (loaded) [android Activity](http://developer.android.com/reference/android/app/Activity.html). This property is automatically updated upon Activity events.
Returns AppCompatActivity

nativeApp

get nativeApp(): Application
The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
Returns Application

packageName

get packageName(): string

paused

get paused(): boolean

startActivity

get startActivity(): AppCompatActivity
The main (start) Activity for the application.
Returns AppCompatActivity

Methods

getNativeApplication

getNativeApplication(): Application

getRegisteredBroadcastReceiver

getRegisteredBroadcastReceiver(intentFilter: string): BroadcastReceiver
Get a registered BroadcastReceiver, then you can get the result code of BroadcastReceiver in onReceiveCallback method.
Parameter Default Description
intentFilter
string

A string containing the intent filter.

Returns BroadcastReceiver

on

on(
  event: "activityCreated",
  callback: (args: AndroidActivityBundleEventData) => void,
  thisArg?: any
): void
Parameter Default Description
event
"activityCreated"

callback
(args: AndroidActivityBundleEventData) => void

thisArg
any

Returns void
on(
  event: "activityDestroyed",
  callback: (args: AndroidActivityEventData) => void,
  thisArg?: any
): void
This event is raised when application css is changed.
Parameter Default Description
event
"activityDestroyed"

callback
(args: AndroidActivityEventData) => void

thisArg
any

Returns void
on(
  event: "activityStarted",
  callback: (args: AndroidActivityEventData) => void,
  thisArg?: any
): void
Event raised then livesync operation is performed.
Parameter Default Description
event
"activityStarted"

callback
(args: AndroidActivityEventData) => void

thisArg
any

Returns void
on(
  event: "activityPaused",
  callback: (args: AndroidActivityEventData) => void,
  thisArg?: any
): void
This event is raised when application css is changed.
Parameter Default Description
event
"activityPaused"

callback
(args: AndroidActivityEventData) => void

thisArg
any

Returns void
on(
  event: "activityResumed",
  callback: (args: AndroidActivityEventData) => void,
  thisArg?: any
): void
This event is raised on application launchEvent.
Parameter Default Description
event
"activityResumed"

callback
(args: AndroidActivityEventData) => void

thisArg
any

Returns void
on(
  event: "activityStopped",
  callback: (args: AndroidActivityEventData) => void,
  thisArg?: any
): void
This event is raised after the application has performed most of its startup actions. Its intent is to be suitable for measuring app startup times.
Parameter Default Description
event
"activityStopped"

callback
(args: AndroidActivityEventData) => void

thisArg
any

Returns void
on(
  event: "saveActivityState",
  callback: (args: AndroidActivityBundleEventData) => void,
  thisArg?: any
): void
This event is raised when the Application is suspended.
Parameter Default Description
event
"saveActivityState"

callback
(args: AndroidActivityBundleEventData) => void

thisArg
any

Returns void
on(
  event: "activityResult",
  callback: (args: AndroidActivityResultEventData) => void,
  thisArg?: any
): void
This event is raised when the Application is resumed after it has been suspended.
Parameter Default Description
event
"activityResult"

callback
(args: AndroidActivityResultEventData) => void

thisArg
any

Returns void
on(
  event: "activityBackPressed",
  callback: (args: AndroidActivityBackPressedEventData) => void,
  thisArg?: any
): void
This event is raised when the Application is about to exit.
Parameter Default Description
event
"activityBackPressed"

callback
(args: AndroidActivityBackPressedEventData) => void

thisArg
any

Returns void
on(
  event: "activityNewIntent",
  callback: (args: AndroidActivityNewIntentEventData) => void,
  thisArg?: any
): void
This event is raised when there is low memory on the target device.
Parameter Default Description
event
"activityNewIntent"

callback
(args: AndroidActivityNewIntentEventData) => void

thisArg
any

Returns void
on(
  event: "activityRequestPermissions",
  callback: (args: AndroidActivityRequestPermissionsEventData) => void,
  thisArg?: any
): void
This event is raised when an uncaught error occurs while the application is running.
Parameter Default Description
event
"activityRequestPermissions"

callback
(args: AndroidActivityRequestPermissionsEventData) => void

thisArg
any

Returns void

registerBroadcastReceiver

registerBroadcastReceiver(
  intentFilter: string,
  onReceiveCallback: (context: Context, intent: Intent) => void
): void
Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread. For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter%29'
Parameter Default Description
intentFilter
string

A string containing the intent filter.

onReceiveCallback
(context: Context, intent: Intent) => void

A callback function that will be called each time the receiver receives a broadcast.

Returns void

unregisterBroadcastReceiver

unregisterBroadcastReceiver(intentFilter: string): void
Unregister a previously registered BroadcastReceiver. For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#unregisterReceiver(android.content.BroadcastReceiver)'
Parameter Default Description
intentFilter
string

A string containing the intent filter with which the receiver was originally registered.

Returns void