App
App is an instance of app module, which provide various functions to interact with app
Methods
app.getPath(name)
nameString
Returns String - A path to a special directory or file associated with name. On failure returns -1
You can request the following paths by the name:
rootroot directory (i.e./system)cachecache directory (i.e./cache)datasystem's data directory (i.e./data)storageinternal storage (i.e./storage/emulated/0)alarmsstorage Alarms directory (i.e./storage/emulated/0/Alarms)dcimstorage DCIM directory (i.e./storage/emulated/0/DCIM)downloadsstorage Download directory (i.e./storage/emulated/0/Download)moviesstorage Movies directory (i.e./storage/emulated/0/Movies)musicstorage Music directory (i.e./storage/emulated/0/Music)notificationsstorage Notifications directory (i.e./storage/emulated/0/Notifications)picturesstorage Pictures directory (i.e./storage/emulated/0/Pictures)podcastsstorage Podcasts directory (i.e./storage/emulated/0/Podcasts)ringtonesstorage Rongtones directory (i.e./storage/emulated/0/Ringtones)appDataapplication data directory (i.e./data/data/package/files)userDataapplication user directory (i.e./storage/sdcard0/Android/data/package/files)
An example of above code:
let path = app.getPath('userData');
console.log(path);
app.loadURL(url)
urlURL
Loads the url in the android webview, the url must contain the protocol prefix, e.g. the http:// or file://.
An example of above code:
app.loadURL('https://google.com');
app.reload()
Reloads the android webview.
An example of above code:
app.reload();
app.setDefaultFontSize(fontSize)
fontSizeInt
Sets the given fontSize as default fontSize for the webview, still it can be overridden through CSS incase required.
An example of above code:
app.setDefaultFontSize(20);