Easily integrate Autonomous Single App Mode (ASAM) in your iOS app, allowing it to control Single App Mode sessions for focused, distraction-free user experiences. Ideal for educational, testing, or kiosk applications. ๐๐ช
- ๐ Enable / Disable Single App Mode programmatically
- ๐ Check if ASAM is currently enabled
- โก Async/Await support โ all methods return Promises
- ๐ฆ Compatible with Capacitor 5, 6, 7 & 8
- ๐ Supports iOS 15 through iOS 26+
npm install capacitor-plugin-asam
npx cap syncTo enable the Autonomous Single App Mode (ASAM) on iOS devices, administrators must utilize a Mobile Device Management (MDM) system or Apple Configurator.
These tools are essential for setting up and managing ASAM, as they provide the ability to create and deploy specific configuration profiles to iOS devices.
These profiles dictate which applications can run in ASAM, ensuring controlled and secure usage of the devices in environments like schools, businesses, or public kiosks. Without MDM or Apple Configurator, activating ASAM on iOS devices is not feasible.
๐ก Tip: Make sure to allowlist your app's bundle ID in the MDM configuration for Autonomous Single App Mode.
// import the plugin
import { Asam } from "capacitor-plugin-asam";
// --------------------
// โ
Enable ASAM using setASAM
let r = await Asam.setASAM({ enable: true });
if (!r.success)
console.error("Failed to enable ASAM");
let isEnabled = (await Asam.isASAMEnabled()).enabled;
console.log("ASAM is enabled: " + isEnabled);
// --------------------
// โ
Another way to enable ASAM using enableASAM
r = await Asam.enableASAM();
if (!r.success)
console.error("Failed to enable ASAM");
isEnabled = (await Asam.isASAMEnabled()).enabled;
console.log("ASAM is enabled: " + isEnabled);
// --------------------
// ๐ Disable ASAM using disableASAM
r = await Asam.disableASAM();
if (!r.success)
console.error("Failed to disable ASAM");
isEnabled = (await Asam.isASAMEnabled()).enabled;
console.log("ASAM is enabled: " + isEnabled);
// --------------------
// ๐ Another way to disable ASAM using setASAM
r = await Asam.setASAM({ enable: false });
if (!r.success)
console.error("Failed to disable ASAM");๐ Full documentation with detailed examples: docs/api.md
setASAM(options: { enable: boolean; }) => Promise<{ success: boolean; }>Enable or disable Autonomous Single App Mode (ASAM) based on the enable parameter.
| Param | Type | Description |
|---|---|---|
options |
{ enable: boolean; } |
- enable: true to activate ASAM, false to deactivate. |
Returns: Promise<{ success: boolean; }>
enableASAM() => Promise<{ success: boolean; }>Enable Autonomous Single App Mode (ASAM) on the device.
Shortcut for setASAM({ enable: true }).
Returns: Promise<{ success: boolean; }>
disableASAM() => Promise<{ success: boolean; }>Disable Autonomous Single App Mode (ASAM) on the device.
Shortcut for setASAM({ enable: false }).
Returns: Promise<{ success: boolean; }>
isASAMEnabled() => Promise<{ enabled: boolean; }>Check whether Autonomous Single App Mode (ASAM) is currently active on the device.
Returns: Promise<{ enabled: boolean; }>
isSupervised() => Promise<{ supervised: boolean; }>Check whether the device is in supervised mode. Only supervised iOS devices can use ASAM.
Returns: Promise<{ supervised: boolean; }>
npm testThis runs the iOS unit tests via Xcode on the iOS Simulator.