Skip to content

Easily integrate Autonomous Single App Mode in your app, allowing it to control Single App Mode sessions for focused, distraction-free user experiences. Ideal for educational, testing, or kiosk applications.

License

Notifications You must be signed in to change notification settings

dimer47/capacitor-plugin-asam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ฑ Capacitor Plugin ASAM (Autonomous Single App Mode)

Release Last update Dependency size Repo size Downloads License iOS 15+ Capacitor 5+

โš ๏ธ iOS only โ€” This plugin uses native iOS APIs and is not available on Android or Web.

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. ๐ŸŽ“๐Ÿช

๐ŸŽ‰ Features

  • ๐Ÿ”’ 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+

๐Ÿ“ Install

npm install capacitor-plugin-asam
npx cap sync

โš™๏ธ Configuration

To 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.

๐Ÿ•น๏ธ Usage

// 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");

๐Ÿงฎ API

๐Ÿ“– Full documentation with detailed examples: docs/api.md

setASAM(...)

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()

enableASAM() => Promise<{ success: boolean; }>

Enable Autonomous Single App Mode (ASAM) on the device. Shortcut for setASAM({ enable: true }).

Returns: Promise<{ success: boolean; }>


disableASAM()

disableASAM() => Promise<{ success: boolean; }>

Disable Autonomous Single App Mode (ASAM) on the device. Shortcut for setASAM({ enable: false }).

Returns: Promise<{ success: boolean; }>


isASAMEnabled()

isASAMEnabled() => Promise<{ enabled: boolean; }>

Check whether Autonomous Single App Mode (ASAM) is currently active on the device.

Returns: Promise<{ enabled: boolean; }>


isSupervised()

isSupervised() => Promise<{ supervised: boolean; }>

Check whether the device is in supervised mode. Only supervised iOS devices can use ASAM.

Returns: Promise<{ supervised: boolean; }>


๐Ÿงช Testing

npm test

This runs the iOS unit tests via Xcode on the iOS Simulator.

๐Ÿงพ License

MIT

About

Easily integrate Autonomous Single App Mode in your app, allowing it to control Single App Mode sessions for focused, distraction-free user experiences. Ideal for educational, testing, or kiosk applications.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •