Monaca Docs
Search
K
Comment on page

Utilities

We describe other functions provided by Monaca.
Method/Property
Description
Get the unique device ID
Get absolute URL to www folder.
Check whether the device is Android or not
Check the device is iOS or not

monaca.getDeviceId()

Get the unique device ID which has been created randomly.
Monaca framework automatically creates a unique device ID at the first time app launch.
monaca.getDeviceId(callback)
Parameter
Parameter
Type
Description
callback
Function
A callback function where device ID is the first parameter
Return Value
  • None
Example
monaca.getDeviceId(function(id){
console.log('Device ID: ' + id);
});

monaca.baseUrl

Get an absolute URL to www folder.
monaca.baseUrl
Return Value
Type
Description
String
The absolute URL of application
Example
window.onload = function()
{
alert(monaca.baseUrl);
}

monaca.isAndroid

Check whether the device is an Android device or not.
monaca.isAndroid
Return Value
Type
Description
boolean
The device is Android device if the return value is true.
Example
if(monaca.isAndroid === true){
alert("Android!");
}

monaca.isIOS

Check whether the device is an iOS device or not .
monaca.isIOS
Return Value
Type
Description
boolean
The device is iOS device if the return value is true.
Example
if(monaca.isIOS === true){
alert("iOS!");
}