This plugin adds an Android Auto integration.
Platform | Supported |
---|---|
Android | ✔ |
iOS | ✖ |
Web | ✖ |
npm install capacitor-android-auto
npx cap sync android
Add this to the activity inside your AndroidManifest.xml:
android:showWhenLocked="true"
android:turnScreenOn="true"
import { AndroidAuto } from 'capacitor-android-auto';
...
AndroidAuto.setTemplate({
template: {
type: TemplateEnum.List,
title: 'My Features',
items: [{ 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
});
setTemplate(options: { template: ListTemplate; }) => Promise<void>
Param | Type |
---|---|
options |
{ template: ListTemplate; } |
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() => Promise<void>
Removes all listeners.
Prop | Type |
---|---|
title |
string |
items |
ListItem[] |
Prop | Type |
---|---|
actionPayload |
any |
title |
string |
Prop | Type |
---|---|
remove |
() => Promise<void> |