am I inside an app (App Inventor / Kodular)?
True when the exported project is open in an App Inventor or Kodular WebViewer.
Export the project as HTML, open it in a Kodular or MIT App Inventor WebViewer and exchange messages with the app: events, requests with answers, TinyDB, toasts, vibrate, share and much more.
In the app: the WebViewer.WebViewStringChange event receives what the project sends (text or JSON). To send something to the project, use WebViewer.RunJavaScript("blocosiaApp('back')") or change the WebViewString property. To answer a request: RunJavaScript("blocosiaApp.responder(ID, 'value')"). In the editor, use "simulate the app sending…" to test. See the full recipe in the Wiki.
To use it: in the editor, click "Extensions" (bottom corner) and add "App (Kodular / App Inventor)".
True when the exported project is open in an App Inventor or Kodular WebViewer.
Sends a text to the app: fires the WebViewer.WebViewStringChange event.
Sends a named event with data as JSON: {"tipo":"evento","nome":…,"dados":…}.
Asks the app for a phone feature: toast, vibrate, open link, share, speak, copy, notification, keep screen on, orientation, another screen or close.
Makes a request with a number (id) and waits for the app's answer (up to 10 s). The app answers with RunJavaScript("blocosiaApp.responder(id, value)").
The answer to the last request.
True if the app answered the last request in time.
Asks the app to store a value in TinyDB (it stays on the phone after the app closes).
Asks the app for a TinyDB tag and waits; the value goes to "app answer".
Starts when the app sends any message or event.
Starts when the app sends an event with that name (e.g. back, pause, coin).
The text of the last message received from the app.
The name of the last event received.
The data of the last event (number, text, list or object).
The current value of the app's WebViewString property.
Reads a parameter from the page address (e.g. game.html?level=2 → level = 2).
Pretends the app sent an event: test the project in the editor without a phone.