JLPluginDevice
A Jasonelle plugin that reports information about the device running the app.
Overview
JLPluginDevice exposes device details to JavaScript. Call it from the web view to learn the operating system, vendor, device type, orientation, and screen size.
Structure
| File | Role |
|---|---|
|
Native side – collects device information and responds to calls from JavaScript. |
|
JavaScript side – registers the plugin on |
How it works
-
The plugin is injected into the web view on page load and registers itself on
window.jasonelle.plugins.device. -
Call
window.jasonelle.plugins.device.info()from JavaScript; it returns a promise. -
The call is routed to
Plugin.kthandle_call(callbackId:args:respond:), which resolves the promise with the device information.
Response
The promise resolves with an object like:
{
"status": "ok",
"os": { "name": "android", "version": "14" },
"vendor": "google",
"type": "phone",
"orientation": "portrait",
"screen": { "width": 1080, "height": 2400 }
}
os.name is always android. type is phone or tablet. orientation is portrait, landscape, or unknown.
Reference
-
com.jasonelle.kernel.Plugin– the base class this plugin extends. -
Plugin.jsinsrc/main/assets/plugins/device/– the JavaScript client, byte-identical to the Xcode plugin.