Open shadycloud opened 1 year ago
Learning how Android Auto & Cordova works,
To 'Add support for Android Auto to your app', 'Declare Android Auto support'
The Android Auto host checks whether the app has declared support for Android Auto. To enable this support, include the following entry in your app's manifest:
<application>
...
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc"/>
...
</application>
https://developer.android.com/training/cars/apps/auto#declare-android-auto-support
https://stackoverflow.com/questions/40446058/cordova-change-androidmanifest-using-config-xml-file
cloud@cloud:~/Downloads/FreeTubeCordova/src/cordova$ cat config.xml
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
</edit-config>
Mark your app as a video app
To indicate that your app supports video, add an XML file named automotive_app_desc.xml to the res/xml/ directory in your project. In this file, include the following content:
<automotiveApp>
<uses name="video"/>
</automotiveApp>
Then, within the
<meta-data
android:name="com.android.automotive"
android:resource="@xml/automotive_app_desc"/>
The more I learn about the differences in cordova to a typical droid app, the more I question if this is even possible...
Related question: https://www.reddit.com/r/androiddev/comments/10jxkwd/cordova_are_there_any_plugins_available_for/ More related: https://github.com/capacitor-community/proposals/issues/94
<metadata
android:name="com.android.automotive"
android:resource="@xml/automotive_app_desc"/>
This looks like this might go in the config.xml
in the section you pointed out earlier. The other xml file, automotive_app_desc.xml
seems like it would need to be added between when pack:cordova
runs and run:cordova
/build:cordova
runs, so, completely speculating from the top of my head, it could likely be injected by ~/_scripts/CordovaPlugin.js
.
Admittedly, this would probably be easier if the project were to switch from Cordova to Capacitor (#101) which is more inline with the DX of a typical android app.
The development branch has now switched away from Cordova. The android studio project is located in the android
directory.
Guidelines
Problem Description
No ability to control this app using Android auto.
Proposed Solution
Android auto integration for play/pause, search, sub, etc.
Alternatives Considered
NA
Issue Labels
ease of use improvement, new feature, support for external software, visual improvement
Additional Information
No response