capacitor-android-auto
v0.0.1
Published
todo
Downloads
18
Readme
capacitor-android-auto
This plugin adds an Android Auto integration.
Supported platforms
| Platform | Supported | | -------- | --------: | | Android | ✔ | | iOS | ✖ | | Web | ✖ |
Install
npm install capacitor-android-auto
npx cap sync androidAdd this to the activity inside your AndroidManifest.xml:
android:showWhenLocked="true"
android:turnScreenOn="true"Usage
import { AndroidAuto } from 'capacitor-android-auto';
...
AndroidAuto.setTemplate({
template: new ListTemplate('My Features', [
{ title: 'Feature 1', actionPayload: 'feature-1' },
]),
});
// Triggered when an android auto list entry was clicked
AndroidAuto.addListener('action', (response: any) => {
// response.data contains the actionPayload
});API
setTemplate(...)
setTemplate(options: { template: ListTemplate; }) => Promise<void>| Param | Type |
| ------------- | -------------------------------------------------------------------- |
| options | { template: ListTemplate; } |
addListener('action', ...)
addListener(eventName: 'action', listenerFunc: (response: { data: any; }) => void) => Promise<PluginListenerHandle>Add a listener when an action in android auto is performed.
| Param | Type |
| ------------------ | -------------------------------------------------- |
| eventName | 'action' |
| listenerFunc | (response: { data: any; }) => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Removes all listeners.
Interfaces
ListTemplate
| Prop | Type |
| ----------- | ----------------------- |
| title | string |
| items | ListItem[] |
ListItem
| Prop | Type |
| ------------------- | ------------------- |
| actionPayload | any |
| title | string |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
