21.2
addStateListener
error = asi.addStateListener(asiStateCallback [, object])
Registers an ASI state-change listener callback. The registration of multiple listener callbacks at the same time is supported. Registered listener callbacks can be removed by calling removeStateListener.
|
Parameter |
Type |
Description |
|---|---|---|
|
asiStateCallback |
in function |
Callback to receive events about ASI state changes. |
|
object |
in any (optional) |
If an object is provided, it will be passed as the first parameter to the specified callback function. The object can be of any type except nil. |
|
error |
out string (optional) |
If successful nil is returned, an error message otherwise. |
Introduced in platform.apiLevel = '2.7'.
Callback Function
asiStateCallback ([object,] state)
The callback function provided in addStateListener will be called for ASI state changes.
|
Parameter |
Type |
Description |
|---|---|---|
|
object |
in any |
If an object was provided as a parameter to the function addStateListener, it will be passed as the first parameter to this callback function. |
|
state |
in asi table constant |
The current ASI state (please see table below). |
ASI State Constants
|
Name |
Description |
|---|---|
|
asi.ON |
ASI has started and is ready. |
|
asi.STARTING |
ASI is starting. |
|
asi.UNSUPPORTED |
ASI is not supported on this platform. |
Introduced in platform.apiLevel = '2.7'.