More detailed API Help here
ActivityResultFacade
- setResultBoolean
- setResultBooleanArray
- setResultByte
- setResultByteArray
- setResultChar
- setResultCharArray
- setResultDouble
- setResultDoubleArray
- setResultFloat
- setResultFloatArray
- setResultInteger
- setResultIntegerArray
- setResultLong
- setResultLongArray
- setResultSerializable
- setResultShort
- setResultShortArray
- setResultString
- setResultStringArray AndroidFacade
- environment
- getClipboard
- getConstants
- getInput
- getIntent
- getPackageVersion
- getPackageVersionCode
- getPassword
- log
- makeIntent
- makeToast
- notify
- requiredVersion
- sendBroadcast
- sendBroadcastIntent
- sendEmail
- setClipboard
- startActivity
- startActivityForResult
- startActivityForResultIntent
- startActivityIntent
- vibrate ApplicationManagerFacade
- forceStopPackage
- getLaunchableApplications
- getRunningPackages
- launch BatteryManagerFacade
- batteryCheckPresent
- batteryGetHealth
- batteryGetLevel
- batteryGetPlugType
- batteryGetStatus
- batteryGetTechnology
- batteryGetTemperature
- batteryGetVoltage
- batteryStartMonitoring
- batteryStopMonitoring
- readBatteryData BluetoothFacade Requires API Level 5.
- bluetoothAccept
- bluetoothActiveConnections
- bluetoothConnect
- bluetoothDiscoveryCancel
- bluetoothDiscoveryStart
- bluetoothGetConnectedDeviceName
- bluetoothGetLocalAddress
- bluetoothGetLocalName
- bluetoothGetRemoteDeviceName
- bluetoothGetScanMode
- bluetoothIsDiscovering
- bluetoothMakeDiscoverable
- bluetoothRead
- bluetoothReadBinary
- bluetoothReadLine
- bluetoothReadReady
- bluetoothSetLocalName
- bluetoothStop
- bluetoothWrite
- bluetoothWriteBinary
- checkBluetoothState
- toggleBluetoothState CameraFacade
- cameraCapturePicture
- cameraInteractiveCapturePicture CommonIntentsFacade
- pick
- scanBarcode
- search
- view
- viewContacts
- viewHtml
- viewMap ContactsFacade
- contactsGet
- contactsGetAttributes
- contactsGetById
- contactsGetCount
- contactsGetIds
- pickContact
- pickPhone
- queryAttributes
- queryContent EventFacade
- eventClearBuffer
- eventGetBrodcastCategories
- eventPoll
- eventPost
- eventRegisterForBroadcast
- eventUnregisterForBroadcast
- eventWait
- eventWaitFor
- postEvent
- receiveEvent
- startEventDispatcher
- stopEventDispatcher
- waitForEvent LocationFacade
- geocode
- getLastKnownLocation
- locationProviderEnabled
- locationProviders
- readLocation
- startLocating
- stopLocating MediaPlayerFacade
- mediaIsPlaying
- mediaPlay
- mediaPlayClose
- mediaPlayInfo
- mediaPlayList
- mediaPlayPause
- mediaPlaySeek
- mediaPlaySetLooping
- mediaPlayStart MediaRecorderFacade
- recorderCaptureVideo
- recorderStartMicrophone
- recorderStartVideo
- recorderStop
- startInteractiveVideoRecording PhoneFacade
- checkNetworkRoaming
- getCellLocation
- getDeviceId
- getDeviceSoftwareVersion
- getLine1Number
- getNeighboringCellInfo
- getNetworkOperator
- getNetworkOperatorName
- getNetworkType
- getPhoneType
- getSimCountryIso
- getSimOperator
- getSimOperatorName
- getSimSerialNumber
- getSimState
- getSubscriberId
- getVoiceMailAlphaTag
- getVoiceMailNumber
- phoneCall
- phoneCallNumber
- phoneDial
- phoneDialNumber
- readPhoneState
- startTrackingPhoneState
- stopTrackingPhoneState PreferencesFacade
- prefGetAll
- prefGetValue
- prefPutValue SensorManagerFacade
- readSensors
- sensorsGetAccuracy
- sensorsGetLight
- sensorsReadAccelerometer
- sensorsReadMagnetometer
- sensorsReadOrientation
- startSensing
- startSensingThreshold
- startSensingTimed
- stopSensing SettingsFacade
- checkAirplaneMode
- checkRingerSilentMode
- checkScreenOn
- getMaxMediaVolume
- getMaxRingerVolume
- getMediaVolume
- getRingerVolume
- getScreenBrightness
- getScreenTimeout
- getVibrateMode
- setMediaVolume
- setRingerVolume
- setScreenBrightness
- setScreenTimeout
- toggleAirplaneMode
- toggleRingerSilentMode
- toggleVibrateMode SignalStrengthFacade Requires API Level 7.
- readSignalStrengths
- startTrackingSignalStrengths
- stopTrackingSignalStrengths SmsFacade
- smsDeleteMessage
- smsGetAttributes
- smsGetMessageById
- smsGetMessageCount
- smsGetMessageIds
- smsGetMessages
- smsMarkMessageRead
- smsSend SpeechRecognitionFacade
- recognizeSpeech TextToSpeechFacade Requires API Level 4.
- ttsIsSpeaking
- ttsSpeak ToneGeneratorFacade
- generateDtmfTones UiFacade
- addContextMenuItem
- addOptionsMenuItem
- clearContextMenu
- clearOptionsMenu
- dialogCreateAlert
- dialogCreateDatePicker
- dialogCreateHorizontalProgress
- dialogCreateInput
- dialogCreatePassword
- dialogCreateSeekBar
- dialogCreateSpinnerProgress
- dialogCreateTimePicker
- dialogDismiss
- dialogGetInput
- dialogGetPassword
- dialogGetResponse
- dialogGetSelectedItems
- dialogSetCurrentProgress
- dialogSetItems
- dialogSetMaxProgress
- dialogSetMultiChoiceItems
- dialogSetNegativeButtonText
- dialogSetNeutralButtonText
- dialogSetPositiveButtonText
- dialogSetSingleChoiceItems
- dialogShow
- fullDismiss
- fullKeyOverride
- fullQuery
- fullQueryDetail
- fullSetList
- fullSetProperty
- fullSetTitle
- fullShow
- webViewShow WakeLockFacade
- wakeLockAcquireBright
- wakeLockAcquireDim
- wakeLockAcquireFull
- wakeLockAcquirePartial
- wakeLockRelease WebCamFacade Requires API Level 8.
- cameraStartPreview
- cameraStopPreview
- webcamAdjustQuality
- webcamStart
- webcamStop WifiFacade
- checkWifiState
- toggleWifiState
- wifiDisconnect
- wifiGetConnectionInfo
- wifiGetScanResults
- wifiLockAcquireFull
- wifiLockAcquireScanOnly
- wifiLockRelease
- wifiReassociate
- wifiReconnect
- wifiStartScan
addContextMenuItem(
String label: label for this menu item,
String event: event that will be generated on menu item click,
Object eventData[optional])
Adds a new item to context menu.
addOptionsMenuItem(
String label: label for this menu item,
String event: event that will be generated on menu item click,
Object eventData[optional],
String iconName[optional]: Android system menu icon, see
http://developer.android.com/reference/android/R.drawable.html)
Adds a new item to options menu.
batteryCheckPresent()
Returns the most recently received battery presence data.
Requires API Level 5.
batteryGetHealth()
Returns the most recently received battery health data:
1 - unknown;
2 - good;
3 - overheat;
4 - dead;
5 - over voltage;
6 - unspecified failure;
batteryGetLevel()
Returns the most recently received battery level (percentage).
Requires API Level 5.
batteryGetPlugType()
Returns the most recently received plug type data:
-1 - unknown
0 - unplugged;
1 - power source is an AC charger
2 - power source is a USB port
batteryGetStatus()
Returns the most recently received battery status data:
1 - unknown;
2 - charging;
3 - discharging;
4 - not charging;
5 - full;
batteryGetTechnology()
Returns the most recently received battery technology data.
Requires API Level 5.
batteryGetTemperature()
Returns the most recently received battery temperature.
Requires API Level 5.
batteryGetVoltage()
Returns the most recently received battery voltage.
Requires API Level 5.
batteryStartMonitoring()
Starts tracking battery state.
Generates "battery" events.
batteryStopMonitoring()
Stops tracking battery state.
bluetoothAccept(
String uuid[optional, default 457807c0-4897-11df-9879-0800200c9a66],
Integer timeout[optional, default 0]: How long to wait for a new connection, 0
is wait for ever)
Listens for and accepts a Bluetooth connection. Blocks until the connection is
established or fails.
Requires API Level 5.
bluetoothActiveConnections()
Returns active Bluetooth connections.
Requires API Level 5.
bluetoothConnect(
String uuid[optional, default 457807c0-4897-11df-9879-0800200c9a66]: The UUID
passed here must match the UUID used by the server device.,
String address[optional]: The user will be presented with a list of discovered
devices to choose from if an address is not provided.)
Connect to a device over Bluetooth. Blocks until the connection is established
or fails.
Returns:
True if the connection was established successfully.
Requires API Level 5.
bluetoothDiscoveryCancel()
Cancel the current device discovery process.
Returns:
true on success, false on error
Requires API Level 5.
bluetoothDiscoveryStart()
Start the remote device discovery process.
Returns:
true on success, false on error
Requires API Level 5.
bluetoothGetConnectedDeviceName(
String connID[optional, default null]: Connection id)
Returns the name of the connected device.
Requires API Level 5.
bluetoothGetLocalAddress()
Returns the hardware address of the local Bluetooth adapter.
Requires API Level 5.
bluetoothGetLocalName()
Gets the Bluetooth Visible device name
Requires API Level 5.
bluetoothGetRemoteDeviceName(
String address: Bluetooth Address For Target Device)
Queries a remote device for it's name or null if it can't be resolved
Requires API Level 5.
bluetoothGetScanMode()
Gets the scan mode for the local dongle.
Return values:
-1 when Bluetooth is disabled.
0 if non discoverable and non connectable.
1 connectable non discoverable.
3 connectable and discoverable.
Requires API Level 5.
bluetoothIsDiscovering()
Return true if the local Bluetooth adapter is currently in the device discovery
process.
Requires API Level 5.
bluetoothMakeDiscoverable(
Integer duration[optional, default 300]: period of time, in seconds, during
which the device should be discoverable)
Requests that the device be discoverable for Bluetooth connections.
Requires API Level 5.
bluetoothRead(
Integer bufferSize[optional, default 4096],
String connID[optional, default null]: Connection id)
Read up to bufferSize ASCII characters.
Requires API Level 5.
bluetoothReadBinary(
Integer bufferSize[optional, default 4096],
String connID[optional, default ]: Connection id)
Read up to bufferSize bytes and return a chunked, base64 encoded string.
Requires API Level 5.
bluetoothReadLine(
String connID[optional, default null]: Connection id)
Read the next line.
Requires API Level 5.
bluetoothReadReady(
String connID[optional, default ]: Connection id)
Returns True if the next read is guaranteed not to block.
Requires API Level 5.
bluetoothSetLocalName(
String name: New local name)
Sets the Bluetooth Visible device name, returns True on success
Requires API Level 5.
bluetoothStop(
String connID[optional, default null]: Connection id)
Stops Bluetooth connection.
Requires API Level 5.
bluetoothWrite(
String ascii,
String connID[optional, default ]: Connection id)
Sends ASCII characters over the currently open Bluetooth connection.
Requires API Level 5.
bluetoothWriteBinary(
String base64: A base64 encoded String of the bytes to be sent.,
String connID[optional, default ]: Connection id)
Send bytes over the currently open Bluetooth connection.
Requires API Level 5.
cameraCapturePicture(
String targetPath,
Boolean useAutoFocus[optional, default true])
Take a picture and save it to the specified path.
Returns:
A map of Booleans autoFocus and takePicture where True indicates success.
cameraInteractiveCapturePicture(
String targetPath)
Starts the image capture application to take a picture and saves it to the
specified path.
cameraStartPreview(
Integer resolutionLevel[optional, default 0]: increasing this number provides
higher resolution,
Integer jpegQuality[optional, default 20]: a number from 0-100,
String filepath[optional]: Path to store jpeg files.)
Start Preview Mode. Throws 'preview' events.
Returns:
True if successful
Requires API Level 8.
cameraStopPreview()
Stop the preview mode.
Requires API Level 8.
checkAirplaneMode()
Checks the airplane mode setting.
Returns:
True if airplane mode is enabled.
checkBluetoothState()
Checks Bluetooth state.
Returns:
True if Bluetooth is enabled.
Requires API Level 5.
checkNetworkRoaming()
Returns true if the device is considered roaming on the current network, for
GSM purposes.
checkRingerSilentMode()
Checks the ringer silent mode setting.
Returns:
True if ringer silent mode is enabled.
checkScreenOn()
Checks if the screen is on or off (requires API level 7).
Returns:
True if the screen is currently on.
checkWifiState()
Checks Wifi state.
Returns:
True if Wifi is enabled.
clearContextMenu()
Removes all items previously added to context menu.
clearOptionsMenu()
Removes all items previously added to options menu.
contactsGet(
JSONArray attributes[optional])
Returns a List of all contacts.
Returns:
a List of contacts as Maps
contactsGetAttributes()
Returns a List of all possible attributes for contacts.
contactsGetById(
Integer id,
JSONArray attributes[optional])
Returns contacts by ID.
contactsGetCount()
Returns the number of contacts.
contactsGetIds()
Returns a List of all contact IDs.
dialogCreateAlert(
String title[optional],
String message[optional])
Create alert dialog.
dialogCreateDatePicker(
Integer year[optional, default 1970],
Integer month[optional, default 1],
Integer day[optional, default 1])
Create date picker dialog.
dialogCreateHorizontalProgress(
String title[optional],
String message[optional],
Integer maximum progress[optional, default 100])
Create a horizontal progress dialog.
dialogCreateInput(
String title[optional, default Value]: title of the input box,
String message[optional, default Please enter value:]: message to display
above the input box,
String defaultText[optional]: text to insert into the input box,
String inputType[optional]: type of input data, ie number or text)
Create a text input dialog.
dialogCreatePassword(
String title[optional, default Password]: title of the input box,
String message[optional, default Please enter password:]: message to display
above the input box)
Create a password input dialog.
dialogCreateSeekBar(
Integer starting value[optional, default 50],
Integer maximum value[optional, default 100],
String title,
String message)
Create seek bar dialog.
dialogCreateSpinnerProgress(
String title[optional],
String message[optional],
Integer maximum progress[optional, default 100])
Create a spinner progress dialog.
dialogCreateTimePicker(
Integer hour[optional, default 0],
Integer minute[optional, default 0],
Boolean is24hour[optional, default false]: Use 24 hour clock)
Create time picker dialog.
dialogDismiss()
Dismiss dialog.
dialogGetInput(
String title[optional, default Value]: title of the input box,
String message[optional, default Please enter value:]: message to display
above the input box,
String defaultText[optional]: text to insert into the input box)
Queries the user for a text input.
dialogGetPassword(
String title[optional, default Password]: title of the password box,
String message[optional, default Please enter password:]: message to display
above the input box)
Queries the user for a password.
dialogGetResponse()
Returns dialog response.
dialogGetSelectedItems()
This method provides list of items user selected.
Returns:
Selected items
dialogSetCurrentProgress(
Integer current)
Set progress dialog current value.
dialogSetItems(
JSONArray items)
Set alert dialog list items.
dialogSetMaxProgress(
Integer max)
Set progress dialog maximum value.
dialogSetMultiChoiceItems(
JSONArray items,
JSONArray selected[optional]: list of selected items)
Set dialog multiple choice items and selection.
dialogSetNegativeButtonText(
String text)
Set alert dialog button text.
dialogSetNeutralButtonText(
String text)
Set alert dialog button text.
dialogSetPositiveButtonText(
String text)
Set alert dialog positive button text.
dialogSetSingleChoiceItems(
JSONArray items,
Integer selected[optional, default 0]: selected item index)
Set dialog single choice items and selected item.
dialogShow()
Show dialog.
environment()
A map of various useful environment details
eventClearBuffer()
Clears all events from the event buffer.
eventGetBrodcastCategories()
Lists all the broadcast signals we are listening for
eventPoll(
Integer number_of_events[optional, default 1])
Returns and removes the oldest n events (i.e. location or sensor update, etc.)
from the event buffer.
Returns:
A List of Maps of event properties.
eventPost(
String name: Name of event,
String data: Data contained in event.,
Boolean enqueue[optional, default null]: Set to False if you don't want your
events to be added to the event queue, just dispatched.)
Post an event to the event queue.
eventRegisterForBroadcast(
String category,
Boolean enqueue[optional, default true]: Should this events be added to the
event queue or only dispatched)
Registers a listener for a new broadcast signal
eventUnregisterForBroadcast(
String category)
Stop listening for a broadcast signal
eventWait(
Integer timeout[optional]: the maximum time to wait)
Blocks until an event occurs. The returned event is removed from the buffer.
Returns:
Map of event properties.
eventWaitFor(
String eventName,
Integer timeout[optional]: the maximum time to wait (in ms))
Blocks until an event with the supplied name occurs. The returned event is not
removed from the buffer.
Returns:
Map of event properties.
forceStopPackage(
String packageName: name of package)
Force stops a package.
fullDismiss()
Dismiss Full Screen.
fullKeyOverride(
JSONArray keycodes: List of keycodes to override,
Boolean enable[optional, default true]: Turn overriding or off)
Override default key actions
fullQuery()
Get Fullscreen Properties
fullQueryDetail(
String id: id of layout widget)
Get fullscreen properties for a specific widget
fullSetList(
String id: id of layout widget,
JSONArray list: List to set)
Attach a list to a fullscreen widget
fullSetProperty(
String id: id of layout widget,
String property: name of property to set,
String value: value to set property to)
Set fullscreen widget property
fullSetTitle(
String title: Activity Title)
Set the Full Screen Activity Title
fullShow(
String layout: String containing View layout,
String title[optional]: Activity Title)
Show Full Screen.
generateDtmfTones(
String phoneNumber,
Integer toneDuration[optional, default 100]: duration of each tone in
milliseconds)
Generate DTMF tones for the given phone number.
geocode(
Double latitude,
Double longitude,
Integer maxResults[optional, default 1]: maximum number of results)
Returns a list of addresses for the given latitude and longitude.
Returns:
A list of addresses.
getCellLocation()
Returns the current cell location.
getClipboard()
Read text from the clipboard.
Returns:
The text in the clipboard.
getConstants(
String classname: Class to get constants from)
Get list of constants (static final fields) for a class
getDeviceId()
Returns the unique device ID, for example, the IMEI for GSM and the MEID for
CDMA phones. Return null if device ID is not available.
getDeviceSoftwareVersion()
Returns the software version number for the device, for example, the IMEI/SV
for GSM phones. Return null if the software version is not available.
getInput(
String title[optional, default SL4A Input]: title of the input box,
String message[optional, default Please enter value:]: message to display
above the input box)
Queries the user for a text input.
Deprecated in r3! Please use dialogGetInput instead.
getIntent()
Returns the intent that launched the script.
getLastKnownLocation()
Returns the last known location of the device.
Returns:
A map of location information by provider.
getLaunchableApplications()
Returns a list of all launchable application class names.
getLine1Number()
Returns the phone number string for line 1, for example, the MSISDN for a GSM
phone. Return null if it is unavailable.
getMaxMediaVolume()
Returns the maximum media volume.
getMaxRingerVolume()
Returns the maximum ringer volume.
getMediaVolume()
Returns the current media volume.
getNeighboringCellInfo()
Returns the neighboring cell information of the device.
getNetworkOperator()
Returns the numeric name (MCC+MNC) of current registered operator.
getNetworkOperatorName()
Returns the alphabetic name of current registered operator.
getNetworkType()
Returns a the radio technology (network type) currently in use on the device.
getPackageVersion(
String packageName)
Returns package version name.
getPackageVersionCode(
String packageName)
Returns package version code.
getPassword(
String title[optional, default SL4A Password Input]: title of the input box,
String message[optional, default Please enter password:]: message to display
above the input box)
Queries the user for a password.
Deprecated in r3! Please use dialogGetPassword instead.
getPhoneType()
Returns the device phone type.
getRingerVolume()
Returns the current ringer volume.
getRunningPackages()
Returns a list of packages running activities or services.
Returns:
List of packages running activities.
getScreenBrightness()
Returns the screen backlight brightness.
Returns:
the current screen brightness between 0 and 255
getScreenTimeout()
Returns the current screen timeout in seconds.
Returns:
the current screen timeout in seconds.
getSimCountryIso()
Returns the ISO country code equivalent for the SIM provider's country code.
getSimOperator()
Returns the MCC+MNC (mobile country code + mobile network code) of the provider
of the SIM. 5 or 6 decimal digits.
getSimOperatorName()
Returns the Service Provider Name (SPN).
getSimSerialNumber()
Returns the serial number of the SIM, if applicable. Return null if it is
unavailable.
getSimState()
Returns the state of the device SIM card.
getSubscriberId()
Returns the unique subscriber ID, for example, the IMSI for a GSM phone. Return
null if it is unavailable.
getVibrateMode(
Boolean ringer[optional])
Checks Vibration setting. If ringer=true then query Ringer setting, else query
Notification setting
Returns:
True if vibrate mode is enabled.
getVoiceMailAlphaTag()
Retrieves the alphabetic identifier associated with the voice mail number.
getVoiceMailNumber()
Returns the voice mail number. Return null if it is unavailable.
launch(
String className)
Start activity with the given class name.
locationProviderEnabled(
String provider: Name of location provider)
Ask if provider is enabled
locationProviders()
Returns availables providers on the phone
log(
String message)
Writes message to logcat.
makeIntent(
String action,
String uri[optional],
String type[optional]: MIME type/subtype of the URI,
JSONObject extras[optional]: a Map of extras to add to the Intent,
JSONArray categories[optional]: a List of categories to add to the Intent,
String packagename[optional]: name of package. If used, requires classname to
be useful,
String classname[optional]: name of class. If used, requires packagename to be
useful,
Integer flags[optional]: Intent flags)
Create an Intent.
Returns:
An object representing an Intent
makeToast(
String message)
Displays a short-duration Toast notification.
mediaIsPlaying(
String tag[optional, default default]: string identifying resource)
Checks if media file is playing.
Returns:
true if playing
mediaPlay(
String url: url of media resource,
String tag[optional, default default]: string identifying resource,
Boolean play[optional, default true]: start playing immediately)
Open a media file
Returns:
true if play successful
mediaPlayClose(
String tag[optional, default default]: string identifying resource)
Close media file
Returns:
true if successful
mediaPlayInfo(
String tag[optional, default default]: string identifying resource)
Information on current media
Returns:
Media Information
mediaPlayList()
Lists currently loaded media
Returns:
List of Media Tags
mediaPlayPause(
String tag[optional, default default]: string identifying resource)
pause playing media file
Returns:
true if successful
mediaPlaySeek(
Integer msec: Position in millseconds,
String tag[optional, default default]: string identifying resource)
Seek To Position
Returns:
New Position (in ms)
mediaPlaySetLooping(
Boolean enabled[optional, default true],
String tag[optional, default default]: string identifying resource)
Set Looping
Returns:
True if successful
mediaPlayStart(
String tag[optional, default default]: string identifying resource)
start playing media file
Returns:
true if successful
notify(
String title: title,
String message)
Displays a notification that will be canceled when the user clicks on it.
phoneCall(
String uri)
Calls a contact/phone number by URI.
phoneCallNumber(
String phone number)
Calls a phone number.
phoneDial(
String uri)
Dials a contact/phone number by URI.
phoneDialNumber(
String phone number)
Dials a phone number.
pick(
String uri)
Display content to be picked by URI (e.g. contacts)
Returns:
A map of result values.
pickContact()
Displays a list of contacts to pick from.
Returns:
A map of result values.
pickPhone()
Displays a list of phone numbers to pick from.
Returns:
The selected phone number.
rpcPostEvent(
String name,
String data)
Post an event to the event queue.
Deprecated in r4! Please use eventPost instead.
prefGetAll(
String filename[optional]: Desired preferences file. If not defined, uses the
default Shared Preferences.)
Get list of Shared Preference Values
Returns:
Map of key,value
prefGetValue(
String key,
String filename[optional]: Desired preferences file. If not defined, uses the
default Shared Preferences.)
Read a value from shared preferences
prefPutValue(
String key,
Object value,
String filename[optional]: Desired preferences file. If not defined, uses the
default Shared Preferences.)
Write a value to shared preferences
queryAttributes(
String uri: The URI, using the content:// scheme, for the content to
retrieve.)
Content Resolver Query Attributes
Returns:
a list of available columns for a given content uri
queryContent(
String uri: The URI, using the content:// scheme, for the content to
retrieve.,
JSONArray attributes[optional]: A list of which columns to return. Passing
null will return all columns,
String selection[optional]: A filter declaring which rows to return,
JSONArray selectionArgs[optional]: You may include ?s in selection, which will
be replaced by the values from selectionArgs,
String order[optional]: How to order the rows)
Content Resolver Query
Returns:
result of query as Maps
readBatteryData()
Returns the most recently recorded battery data.
readLocation()
Returns the current location as indicated by all available providers.
Returns:
A map of location information by provider.
readPhoneState()
Returns the current phone state and incoming number.
Returns:
A Map of "state" and "incomingNumber"
readSensors()
Returns the most recently recorded sensor data.
readSignalStrengths()
Returns the current signal strengths.
Returns:
A map of "gsm_signal_strength"
Requires API Level 7.
receiveEvent()
Returns and removes the oldest event (i.e. location or sensor update, etc.)
from the event buffer.
Returns:
Map of event properties.
Deprecated in r4! Please use eventPoll instead.
recognizeSpeech(
String prompt[optional]: text prompt to show to the user when asking them to
speak,
String language[optional]: language override to inform the recognizer that it
should expect speech in a language different than the one set in the
java.util.Locale.getDefault(),
String languageModel[optional]: informs the recognizer which speech model to
prefer (see android.speech.RecognizeIntent))
Recognizes user's speech and returns the most likely result.
Returns:
An empty string in case the speech cannot be recongnized.
recorderCaptureVideo(
String targetPath,
Integer duration[optional],
Boolean recordAudio[optional, default true])
Records video (and optionally audio) from the camera and saves it to the given
location.
Duration specifies the maximum duration of the recording session.
If duration is not provided this method will return immediately and the
recording will only be stopped
when recorderStop is called or when a scripts exits.
Otherwise it will block for the time period equal to the duration argument.
recorderStartMicrophone(
String targetPath)
Records audio from the microphone and saves it to the given location.
recorderStartVideo(
String targetPath,
Integer duration[optional, default 0],
Integer videoSize[optional, default 1])
Records video from the camera and saves it to the given location.
Duration specifies the maximum duration of the recording session.
If duration is 0 this method will return and the recording will only be stopped
when recorderStop is called or when a scripts exits.
Otherwise it will block for the time period equal to the duration argument.
videoSize: 0=160x120, 1=320x240, 2=352x288, 3=640x480, 4=800x480.
recorderStop()
Stops a previously started recording.
requiredVersion(
Integer requiredVersion)
Checks if version of SL4A is greater than or equal to the specified version.
scanBarcode()
Starts the barcode scanner.
Returns:
A Map representation of the result Intent.
search(
String query)
Starts a search for the given query.
sendBroadcast(
String action,
String uri[optional],
String type[optional]: MIME type/subtype of the URI,
JSONObject extras[optional]: a Map of extras to add to the Intent,
String packagename[optional]: name of package. If used, requires classname to
be useful,
String classname[optional]: name of class. If used, requires packagename to be
useful)
Send a broadcast.
sendBroadcastIntent(
Intent intent: Intent in the format as returned from makeIntent)
Send Broadcast Intent
sendEmail(
String to: A comma separated list of recipients.,
String subject,
String body,
String attachmentUri[optional])
Launches an activity that sends an e-mail message to a given recipient.
sensorsGetAccuracy()
Returns the most recently received accuracy value.
sensorsGetLight()
Returns the most recently received light value.
sensorsReadAccelerometer()
Returns the most recently received accelerometer values.
Returns:
a List of Floats [(acceleration on the) X axis, Y axis, Z axis].
sensorsReadMagnetometer()
Returns the most recently received magnetic field values.
Returns:
a List of Floats [(magnetic field value for) X axis, Y axis, Z axis].
sensorsReadOrientation()
Returns the most recently received orientation values.
Returns:
a List of Doubles [azimuth, pitch, roll].
setClipboard(
String text)
Put text in the clipboard.
setMediaVolume(
Integer volume)
Sets the media volume.
setResultBoolean(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Boolean resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultBooleanArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Boolean[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultByte(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Byte resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultByteArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Byte[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultChar(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Character resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultCharArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Character[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultDouble(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Double resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultDoubleArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Double[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultFloat(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Float resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultFloatArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Float[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultInteger(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Integer resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultIntegerArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Integer[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultLong(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Long resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultLongArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Long[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultSerializable(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Serializable resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultShort(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Short resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultShortArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
Short[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultString(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
String resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setResultStringArray(
Integer resultCode: The result code to propagate back to the originating
activity, often RESULT_CANCELED (0) or RESULT_OK (-1),
String[] resultValue)
Sets the result of a script execution. Whenever the script APK is called via
startActivityForResult(), the resulting intent will contain SCRIPT_RESULT extra
with the given value.
setRingerVolume(
Integer volume)
Sets the ringer volume.
setScreenBrightness(
Integer value: brightness value between 0 and 255)
Sets the the screen backlight brightness.
Returns:
the original screen brightness.
setScreenTimeout(
Integer value)
Sets the screen timeout to this number of seconds.
Returns:
The original screen timeout.
smsDeleteMessage(
Integer id)
Deletes a message.
Returns:
True if the message was deleted
smsGetAttributes()
Returns a List of all possible message attributes.
smsGetMessageById(
Integer id: message ID,
JSONArray attributes[optional])
Returns message attributes.
smsGetMessageCount(
Boolean unreadOnly,
String folder[optional, default inbox])
Returns the number of messages.
smsGetMessageIds(
Boolean unreadOnly,
String folder[optional, default inbox])
Returns a List of all message IDs.
smsGetMessages(
Boolean unreadOnly,
String folder[optional, default inbox],
JSONArray attributes[optional])
Returns a List of all messages.
Returns:
a List of messages as Maps
smsMarkMessageRead(
JSONArray ids: List of message IDs to mark as read.,
Boolean read)
Marks messages as read.
Returns:
number of messages marked read
smsSend(
String destinationAddress: typically a phone number,
String text)
Sends an SMS.
startActivity(
String action,
String uri[optional],
String type[optional]: MIME type/subtype of the URI,
JSONObject extras[optional]: a Map of extras to add to the Intent,
Boolean wait[optional]: block until the user exits the started activity,
String packagename[optional]: name of package. If used, requires classname to
be useful,
String classname[optional]: name of class. If used, requires packagename to be
useful)
Starts an activity.
startActivityForResult(
String action,
String uri[optional],
String type[optional]: MIME type/subtype of the URI,
JSONObject extras[optional]: a Map of extras to add to the Intent,
String packagename[optional]: name of package. If used, requires classname to
be useful,
String classname[optional]: name of class. If used, requires packagename to be
useful)
Starts an activity and returns the result.
Returns:
A Map representation of the result Intent.
startActivityForResultIntent(
Intent intent: Intent in the format as returned from makeIntent)
Starts an activity and returns the result.
Returns:
A Map representation of the result Intent.
startActivityIntent(
Intent intent: Intent in the format as returned from makeIntent,
Boolean wait[optional]: block until the user exits the started activity)
Start Activity using Intent
startEventDispatcher(
Integer port[optional, default 0]: Port to use)
Opens up a socket where you can read for events posted
startInteractiveVideoRecording(
String path)
Starts the video capture application to record a video and saves it to the
specified path.
startLocating(
Integer minDistance[optional, default 60000]: minimum time between updates in
milliseconds,
Integer minUpdateDistance[optional, default 30]: minimum distance between
updates in meters)
Starts collecting location data.
Generates "location" events.
startSensing(
Integer sampleSize[optional, default 5]: number of samples for calculating
average readings)
Starts recording sensor data to be available for polling.
Deprecated in 4! Please use startSensingTimed or startSensingThreshhold
instead.
startSensingThreshold(
Integer sensorNumber: 1 = Orientation, 2 = Accelerometer, 3 = Magnetometer and
4 = Light,
Integer threshold: Threshold level for chosen sensor (integer),
Integer axis: 0 = No axis, 1 = X, 2 = Y, 3 = X+Y, 4 = Z, 5= X+Z, 6 = Y+Z, 7 =
X+Y+Z)
Records to the Event Queue sensor data exceeding a chosen threshold.
Generates "threshold" events.
startSensingTimed(
Integer sensorNumber: 1 = All, 2 = Accelerometer, 3 = Magnetometer and 4 =
Light,
Integer delayTime: Minimum time between readings in milliseconds)
Starts recording sensor data to be available for polling.
Generates "sensors" events.
startTrackingPhoneState()
Starts tracking phone state.
Generates "phone" events.
startTrackingSignalStrengths()
Starts tracking signal strengths.
Generates "signal_strengths" events.
Requires API Level 7.
stopEventDispatcher()
Stops the event server, you can't read in the port anymore
stopLocating()
Stops collecting location data.
stopSensing()
Stops collecting sensor data.
stopTrackingPhoneState()
Stops tracking phone state.
stopTrackingSignalStrengths()
Stops tracking signal strength.
Requires API Level 7.
toggleAirplaneMode(
Boolean enabled[optional])
Toggles airplane mode on and off.
Returns:
True if airplane mode is enabled.
toggleBluetoothState(
Boolean enabled[optional],
Boolean prompt[optional, default true]: Prompt the user to confirm changing
the Bluetooth state.)
Toggle Bluetooth on and off.
Returns:
True if Bluetooth is enabled.
Requires API Level 5.
toggleRingerSilentMode(
Boolean enabled[optional])
Toggles ringer silent mode on and off.
Returns:
True if ringer silent mode is enabled.
toggleVibrateMode(
Boolean enabled[optional],
Boolean ringer[optional])
Toggles vibrate mode on and off. If ringer=true then set Ringer setting, else
set Notification setting
Returns:
True if vibrate mode is enabled.
toggleWifiState(
Boolean enabled[optional])
Toggle Wifi on and off.
Returns:
True if Wifi is enabled.
ttsIsSpeaking()
Returns True if speech is currently in progress.
Requires API Level 4.
ttsSpeak(
String message)
Speaks the provided message via TTS.
Requires API Level 4.
vibrate(
Integer duration[optional, default 300]: duration in milliseconds)
Vibrates the phone or a specified duration in milliseconds.
view(
String uri,
String type[optional]: MIME type/subtype of the URI,
JSONObject extras[optional]: a Map of extras to add to the Intent)
Start activity with view action by URI (i.e. browser, contacts, etc.).
viewContacts()
Opens the list of contacts.
viewHtml(
String path: the path to the HTML file)
Opens the browser to display a local HTML file.
viewMap(
String query, e.g. pizza, 123 My Street)
Opens a map search for query (e.g. pizza, 123 My Street).
waitForEvent(
String eventName,
Integer timeout[optional]: the maximum time to wait)
Blocks until an event with the supplied name occurs. The returned event is not
removed from the buffer.
Returns:
Map of event properties.
Deprecated in r4! Please use eventWaitFor instead.
wakeLockAcquireBright()
Acquires a bright wake lock (CPU on, screen bright).
wakeLockAcquireDim()
Acquires a dim wake lock (CPU on, screen dim).
wakeLockAcquireFull()
Acquires a full wake lock (CPU on, screen bright, keyboard bright).
wakeLockAcquirePartial()
Acquires a partial wake lock (CPU on).
wakeLockRelease()
Releases the wake lock.
webViewShow(
String url,
Boolean wait[optional]: block until the user exits the WebView)
Display a WebView with the given URL.
webcamAdjustQuality(
Integer resolutionLevel[optional, default 0]: increasing this number provides
higher resolution,
Integer jpegQuality[optional, default 20]: a number from 0-100)
Adjusts the quality of the webcam stream while it is running.
Requires API Level 8.
webcamStart(
Integer resolutionLevel[optional, default 0]: increasing this number provides
higher resolution,
Integer jpegQuality[optional, default 20]: a number from 0-100,
Integer port[optional, default 0]: If port is specified, the webcam service
will bind to port, otherwise it will pick any available port.)
Starts an MJPEG stream and returns a Tuple of address and port for the stream.
Requires API Level 8.
webcamStop()
Stops the webcam stream.
Requires API Level 8.
wifiDisconnect()
Disconnects from the currently active access point.
Returns:
True if the operation succeeded.
wifiGetConnectionInfo()
Returns information about the currently active access point.
wifiGetScanResults()
Returns the list of access points found during the most recent Wifi scan.
wifiLockAcquireFull()
Acquires a full Wifi lock.
wifiLockAcquireScanOnly()
Acquires a scan only Wifi lock.
wifiLockRelease()
Releases a previously acquired Wifi lock.
wifiReassociate()
Reassociates with the currently active access point.
Returns:
True if the operation succeeded.
wifiReconnect()
Reconnects to the currently active access point.
Returns:
True if the operation succeeded.
wifiStartScan()
Starts a scan for Wifi access points.
Returns:
True if the scan was initiated successfully.