The top-level Platform module. The Platform module is used to access the device's platform-related functionality.
Obtaining battery data when the battery state changes.
Titanium.Platform.addEventListener('battery', function(e){
Ti.API.info('The battery state has changed to ' + e.state);
Ti.API.info('The battery level is ' + e.level);
Ti.API.info('The battery event source is ' + e.source);
Ti.API.info('The battery event name ' + e.type);
});
Constant to indicate that the system is plugged in and currently being charged.
Constant to indicate that the system is plugged in and currently being charged.
Constant to indicate that the battery is fully charged.
Constant to indicate that the battery is fully charged.
Constant to indicate that the battery state is not known or monitoring is disabled.
Constant to indicate that the battery state is not known or monitoring is disabled.
Constant to indicate that the system is unplugged.
Constant to indicate that the system is unplugged.
System's WIFI IP address. No other network types are supported.
The name of the API that this proxy corresponds to.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
System's unused memory, measured in megabytes on iOS and bytes on Android.
System's unused memory, measured in megabytes on iOS and bytes on Android.
Battery level in percent, accessible only when batteryMonitoring
is enabled. Measured
in 5% increments on iPhone/iPad.
Determines whether battery monitoring is enabled.
Default: false
Indicates the state of the battery. Accessible only when batteryMonitoring
is enabled.
This API can be assigned the following constants:
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Default: true
Returns the DisplayCaps object.
Returns the DisplayCaps object.
Note that the displayCaps
property begins with a lowercase letter, which differentiates it
from the DisplayCaps
object that it returns.
Applications's globally-unique ID (UUID).
Applications's globally-unique ID (UUID).
On Android, this may be the UDID (unique device ID). For iOS, this is a unique identifier for this install of the application.
Previously on iOS this may have been a UDID, but access to this has been restricted by Apple. For more information, see Apple's uniqueIdentifier documentation.
To use a UUID across different applications of the same vendor, use identifierForVendor instead.
To use a UUID for tracking / advertising purposes, use identifierForAdvertising instead.
An alphanumeric string unique to each device, used only for serving advertisements.
An alphanumeric string unique to each device, used only for serving advertisements.
Unlike the identifierForVendor property, the same value is returned to all vendors. This identifier may change, for example, if the user erases the device, so you should not cache it.
In iOS 10.0 and later, the value of this property is all zeroes when the user has limited ad tracking.
If the value is null
, wait and get the value again later. This happens,
for example, after the device has been restarted but before the user has
unlocked the device.
An alphanumeric string that uniquely identifies a device to the app's vendor.
An alphanumeric string that uniquely identifies a device to the app's vendor.
The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor. See the Apple docs for more infos.
A Boolean value that indicates whether the user has limited ad tracking.
A Boolean value that indicates whether the user has limited ad tracking.
Check the value of this property before performing any advertising tracking. If the value is false, use the advertising identifier only for the following purposes: frequency capping, attribution, conversion events, estimating the number of unique users, advertising fraud detection, and debugging.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.
System's default language.
System's default language.
Locale, as a combination of ISO 2-letter language and country codes. For example,
en-US
or en-GB
. See the
ISO 639-1 and
ISO 3166-1 alpha-2
sections of wikipedia for reference.
System's network interface mac address, or app UUID.
System's network interface mac address, or app UUID.
On iOS, this value is the app's UUID. Apple does not allow access to any hardware identifier information as it can be used for unique device identification, which they have prohibited.
Manufacturer of the device.
Manufacturer of the device.
Returns the manufacturer of the device, for example, motorola
.
Virtual devices return unknown
.
Model of the device.
Model of the device.
An identifier of the hardware model of the device. For example, HTC Sensation Z710e
.
Virtual devices will also return a value. For example, sdk
for the standard Android SDK
and google_sdk
for the enhanced Android Google APIs SDK running in an emulator, and
Simulator
for iOS running in a simulator.
Determine whether the application is running on a virtual device.
if (Ti.Platform.model === 'Simulator' || Ti.Platform.model.indexOf('sdk') !== -1 ){
alert('Accelerometer does not work on a virtual device');
} else {
// Add Accelerometer event listener
}
Name of the platform. Returns android
for the Android platform, iPhone OS
for the iOS
platform (iPhone, iPad, or iPod Touch), and windows
for the Windows platform.
Since iOS 10 this property returns iOS
for for the iOS platform (iPhone, iPad, or iPod Touch).
System's WIFI network mask. No other network types are supported.
Short name of the system's Operating System. Returns android
for the Android platfrom,
iphone
for the iPhone or iPod Touch, ipad
for the iPad, windowsphone
for Windows Phone, and windowsstore
for Windows Store
platform.
Operating System architecture. On Android, this is 32bit
.
Short name of the JavaScript runtime in use.
Short name of the JavaScript runtime in use.
On iOS this is "javascriptcore", on Android either "v8" or "rhino".
System name, if set. On iOS, this can be found in Settings > General > About > Name.
Adds the specified callback as an event listener for the named event.
Name of the event.
Callback function to invoke when the event is fired.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
A dictionary of properties to apply.
Returns whether the system is configured with a default application to handle the URL's protocol.
On iOS, this method might return false if you have not whitelisted the URL schemes you query in your tiapp.xml.
The url to check.
Creates a globally-unique identifier.
Fires a synthesized event to any registered listeners.
Name of the event.
A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.
Returns whether the system settings are configured to show times in 24-hour format.
Opens this URL using the system's default application for its protocol.
The url to open.
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback
parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Name of the event.
Callback function to remove. Must be the same function passed to addEventListener
.
Sets the value of the batteryMonitoring property.
New value for the property.
Sets the value of the bubbleParent property.
New value for the property.
Sets the value of the identifierForAdvertising property.
New value for the property.
Sets the value of the lifecycleContainer property.
New value for the property.
Fired when the battery state changes. This is measured in 5% increments on iPhone/iPad.
The battery state.
This API can be assigned the following constants:
Percentage battery power level.
Source object that fired the event.
Name of the event fired.
True if the event will try to bubble up if possible.
Set to true to stop the event from bubbling.