Class RuntimeApi
Class defined in:runtime-api.js:196
The RuntimeApi object
RuntimeApi
(
)
runtime-api.js:196
Example
var api = external.getUnityObject('1.0');
api.RuntimeApi.getApplication(function(application) {
console.log('Application name: ' + application.getApplicationName());
});
getApplication
( callback
)
runtime-api.js:245
Creates an Application object.
Parameters:-
callback
<Function (Application)>
getApplicationName
(
)
runtime-api.js:53
Retrieves the application name.
application name
getApplicationWritableLocation
(
)
runtime-api.js:75
Retrieves the fileystem location where the application is allowed to write its data in.
application writable location path
getInputMethodName
(
)
runtime-api.js:162
Retrieves the current input method's name. The name varies depending on the platform e.g. maliit can be part of the name for a maliit based Virtual Keyboard (possibly mangled with e.g. 'phablet'), when a keyboard is there the name can be empty, ...
current input method name
getPlatformInfos
(
)
runtime-api.js:85
Retrieves current platform information.
platform information as a dictionary with the following keys:
- name: the platform name
getScreenOrientation
(
)
runtime-api.js:129
Retrieves the current screen orientation.
current screen orientation.
onAboutToQuit
( callback
)
runtime-api.js:96
Sets up a callback that is to be called when the application is about to quit.
Parameters:-
callback
<Function()>Function to be called when the application is about to quit.
onActivated
( callback
)
runtime-api.js:118
Sets up a callback that is to be called when the application has been activated (from background).
Parameters:-
callback
<Function()>Function to be called when the application has been activated.
onApplicationNameChanged
( callback
)
runtime-api.js:63
Sets up a callback that is to be called when the application's name changed.
Parameters:-
callback
<Function(String)>Function to be called when the application's name has changed.
onDeactivated
( callback
)
runtime-api.js:107
Sets up a callback that is to be called when the application has been deactivated (background).
Parameters:-
callback
<Function()>Function to be called when the application has been deactivated.
onInputMethodVisibilityChanged
( callback
)
runtime-api.js:174
Sets up a callback that is to be called when the On Screen Keyboard visibility has changed.
Parameters:-
callback
<Function(Bool)>Function to be called when the On Screen Keyboard visibility has changed (received the visibility as an arg).
onScreenOrientationChanged
( callback
)
runtime-api.js:139
Sets up a callback that is to be called when the application's screen has changed its orientation.
Parameters:-
callback
<Function(ScreenOrientation)>Function to be called when the application's screen orientation has changed.
setupUriHandler
( callback
)
runtime-api.js:151
Sets up a URI handler. The application can be sent URIs to open.
Parameters:-
callback
<Function(String)>Function to be called with the current list of uris to open
ScreenOrientation
<Object> (static)runtime-api.js:209
Enumeration of the available types of ScreenOrientation.
Values:
Landscape: The application screen is in landscape mode
InvertedLandscape: The application screen is in inverted landscape mode
Portrait: The application screen is in portrait mode
InvertedPortrait: The application screen is in inverted portrait mode
Unknown: The application screen is in an unknown mode
Example
var api = external.getUnityObject('1.0');
var orientation = api.RuntimeApi.ScreenOrientation;
// use orientation.Landscape or orientation.Portrait