@nadlowebagentur/capacitor-device-control
v0.0.3
Published
Device control helpers for Capacitor (wake, open app, sleep, admin/notifications checks)
Downloads
65
Readme
capacitor-device-control
Android-first device control helpers for Capacitor (wake, open app, sleep, admin checks).
iOS and web implementations are stubs for now.
Install
npm install @nadlowebagentur/capacitor-device-control
npx cap syncAPI
wakeUp(...)openApp(...)sleep()isAdminActive()requestAdmin(...)ensureAdmin(...)isScreenOn()addListener('screenStateChanged', ...)removeAllListeners()- Interfaces
wakeUp(...)
wakeUp(options?: WakeOptions | undefined) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------- |
| options | WakeOptions |
openApp(...)
openApp(options?: OpenAppOptions | undefined) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------------- |
| options | OpenAppOptions |
sleep()
sleep() => Promise<SleepResult>Returns: Promise<SleepResult>
isAdminActive()
isAdminActive() => Promise<AdminStatus>Returns: Promise<AdminStatus>
requestAdmin(...)
requestAdmin(options?: AdminPromptOptions | undefined) => Promise<AdminStatus>| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| options | AdminPromptOptions |
Returns: Promise<AdminStatus>
ensureAdmin(...)
ensureAdmin(options?: AdminPromptOptions | undefined) => Promise<AdminStatus>| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| options | AdminPromptOptions |
Returns: Promise<AdminStatus>
isScreenOn()
isScreenOn() => Promise<ScreenState>Returns: Promise<ScreenState>
addListener('screenStateChanged', ...)
addListener(eventName: 'screenStateChanged', listener: (state: ScreenState) => void) => Promise<PluginListenerHandle>| Param | Type |
| --------------- | ----------------------------------------------------------------------- |
| eventName | 'screenStateChanged' |
| listener | (state: ScreenState) => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Interfaces
WakeOptions
| Prop | Type |
| ------------------ | -------------------- |
| reason | string |
| bringToFront | boolean |
OpenAppOptions
| Prop | Type |
| ------------ | ------------------- |
| reason | string |
SleepResult
| Prop | Type |
| ------------- | -------------------- |
| success | boolean |
| reason | string |
AdminStatus
| Prop | Type |
| ------------ | -------------------- |
| active | boolean |
AdminPromptOptions
| Prop | Type |
| ----------------- | -------------------- |
| enabled | boolean |
| title | string |
| message | string |
| actionLabel | string |
| cancelLabel | string |
ScreenState
| Prop | Type |
| ---------------- | -------------------- |
| isScreenOn | boolean |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
