This document describes all the interface methods available in questphone. check here for complete usage.
Check interface listener's code for questphone on android here
generate a quest to test every interface open setup
Marks the current quest as completed in the app.
Usage:
WebAppInterface.onQuestCompleted();Shows a toast message on the device. Usage:
WebApp.toast("Hello from JS!");Sends a broadcast with the specified action and optional JSON payload. Usage:
WebApp.sendBroadcast("ACTION_NAME", '{"key":"value"}');Returns the current user data as a JSON string. Usage:
const userData = WebApp.getUserData();Registers the WebView to listen for broadcasts. Provide a JSON array of actions. Usage:
WebApp.registerReceiver('["ACTION_1","ACTION_2"]');Unregisters all broadcast receivers. Usage:
WebApp.unregisterAll();Returns true if the current quest is completed.
Usage:
const completed = WebApp.isQuestCompleted();Enables fullscreen mode in the app. Usage:
WebApp.enableFullScreen();Disables fullscreen mode. Usage:
WebApp.disableFullScreen();Returns the app version code. Usage:
const version = WebApp.getVersion();Schedules a notification alarm at the given timestamp. Usage:
WebApp.setAlarmedNotification(Date.now() + 60000, "Reminder", "Time to do your quest!");Opens another app by package name or redirects to Play Store if not installed. Usage:
WebApp.openApp("com.example.app");Shares plain text using Android share sheet. Usage:
WebApp.shareText("Check this!", "Hello world");Shares an image provided as a Base64 string. Usage:
WebApp.shareImage("data:image/png;base64,iVBORw0KGgoAAAANS...");Returns the current coin reward ratio from app preferences. Usage:
const ratio = WebApp.getCoinRewardRatio();Fetches all quest stats asynchronously and calls the JS function onStatsReceived(stats).
Usage:
WebApp.getAllStatsForQuest();
function onStatsReceived(stats) {
WebApp.toast("Stats: " + stats);
}Fetches a URL without CORS restrictions. headersJson is optional. callback is the JS function to call with the response.
Usage:
WebApp.fetchDataWithoutCorsAsync("https://example.com/data", '{"Authorization":"Bearer token"}', "handleFetch");
function handleFetch(result) {
WebApp.toast(result);
}