Skip to content

NePheus/capacitor-android-auto

Repository files navigation

npm version capacitor support

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 android

Add this to the activity inside your AndroidManifest.xml:

android:showWhenLocked="true"
android:turnScreenOn="true"

Usage

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
});

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>

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published