HTML to APK Builder

ANDROIDAPI REFERENCE

AndroidAPI: Android settings, intents and phone actions

Check permissions, open system apps and settings, handle phone actions, and use device features from JavaScript.

Updated:

Check permissions, open system apps and settings, handle phone actions, and use device features from JavaScript. See the AndroidAPI method index for the event format and other method groups.

Pass JSON arguments as strings with JSON.stringify(). Register event listeners before calling the method. When a result contains callbackId, match it to the request.

Permission status and special access

Use full permission names such as android.permission.POST_NOTIFICATIONS. Detailed requests take a JSON array string and an optional plain-text explanation of up to 500 characters. Status values include granted, denied, permanently_denied and not_declared. A detailed request can also report cancelled.

Call Return or event Project permission Usage
AndroidAPI.getPermissionStatus(permission) — — Permission status string
AndroidAPI.getDeclaredPermissions() — — JSON array of declared permissions
AndroidAPI.requestPermissionsDetailed(permissionsJson, callbackId) / AndroidAPI.requestPermissionsDetailed(permissionsJson, callbackId, rationale) permissionsDetailedResult — Ask for permissions. The result includes a results map from permission to status.
AndroidAPI.canUseSpecialAccess(kind) — — Boolean access check. Example kinds are exact_alarm, overlay, all_files, battery_optimization and notification_policy.
AndroidAPI.openSpecialAccessSettings(kind, callbackId) specialAccessResult — Open the settings screen for a kind. The event includes kind and granted on return.

Open Android apps and settings

Calls that open another app report whether Android could launch the screen. The user completes the operation in that app. Handle no_app, invalid_argument and launch_failed.

Call Return or event Project permission Usage
AndroidAPI.dial(number, callbackId) intentResult — Open the dialer with a filled-in number.
AndroidAPI.composeSms(number, body, callbackId) intentResult — Open a text-message draft.
AndroidAPI.composeEmail(json, callbackId) intentResult — Open an email draft with JSON fields to, cc, bcc, subject and body. Address fields are arrays.
AndroidAPI.insertCalendarEvent(json, callbackId) intentResult — Open the calendar editor with title, description, location, start, end and allDay. Times are epoch milliseconds.
AndroidAPI.setAlarmClock(json, callbackId) intentResult SET_ALARM Pass JSON with hour, minute, message, optional days (1 is Sunday) and skipUi.
AndroidAPI.setTimer(seconds, message, skipUi, callbackId) intentResult SET_ALARM Start a timer through the clock app with 1 to 86,400 seconds.
AndroidAPI.openMap(json, callbackId) intentResult — Open a map using JSON with query or lat, lng and label.
AndroidAPI.openAppStorePage(packageName, callbackId) intentResult — Open a package’s store page. An empty package name selects the current app.
AndroidAPI.openSettings(kind, callbackId) intentResult — Open a system settings page, for example wifi, bluetooth, nfc, location or app.
AndroidAPI.pickContact(kind, callbackId) contactPicked — Pick one phone (default) or email entry. The picker shares the selected contact.
AndroidAPI.requestPinShortcut(json, callbackId) shortcutResult — Ask the launcher to pin a shortcut with id, label, url and optional iconBase64. Handle the launch with window.onDeepLink.
AndroidAPI.setWallpaper(base64Image, target, callbackId) wallpaperResult SET_WALLPAPER Set a Base64 image of up to 16 MB for home, lock or both.
window.addEventListener('intentResult', ({ detail }) => {
  if (detail.callbackId === 'map' && !detail.success) console.error(detail.error);
});
AndroidAPI.openMap(JSON.stringify({ query: 'Istanbul' }), 'map');

Phone and SMS

Use the dialer or SMS draft when the user can complete the action in the other app. Direct calls and SMS require the corresponding project permission, a bundled page and an explicit confirmation in the Android shell. Handle cancelled, permission_denied and rate_limited.

Call Return or event Project permission Usage
AndroidAPI.getTelephonyInfo() — READ_BASIC_PHONE_STATE Return SIM and carrier state as JSON. Network type and roaming can be limited without READ_BASIC_PHONE_STATE (Android 13+) or READ_PHONE_STATE on older Android.
AndroidAPI.callNumber(number, callbackId) callResult CALL_PHONE Place a call after confirmation. The number accepts digits, spaces, dashes, +, * and #, up to 32 characters.
AndroidAPI.sendSms(number, text, callbackId) smsResult SEND_SMS Send one text of up to 1,600 characters to one recipient after confirmation. Requires a Pro build with approved high-risk SEND_SMS access. Call while visible.

Device features and file errors

Check feature support before offering hardware controls and read file errors immediately after a failed operation.

Call Return or event Project permission Usage
AndroidAPI.irStatus() — — Return JSON with supported and frequencies: [{min, max}].
AndroidAPI.irTransmit(frequencyHz, patternJson, callbackId) irResult TRANSMIT_IR Transmit using a supported frequency in Hz and a JSON array of alternating on/off durations in microseconds (up to 1,024 entries and two seconds total).
AndroidAPI.watchScreenCapture(enabled) screenCaptured DETECT_SCREEN_CAPTURE Enable or disable screenshot detection for the visible activity on Android 14+. Returns a boolean. The event contains time in epoch milliseconds.
AndroidAPI.getDndStatus() — ACCESS_NOTIFICATION_POLICY Return the interruption filter, whether policy accessGranted is set, and error as JSON.
AndroidAPI.lastAppFileError() — — Read the last private file operation’s error. An empty string means success. Codes include not_found, invalid_file_name, file_too_large, read_failed, write_failed and delete_failed.