Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 3.47 KB

android_auto.md

File metadata and controls

75 lines (60 loc) · 3.47 KB

Testing EVMap on Android Auto

In addition to the Android app on the phone, EVMap is also available as an Android Auto app built using the Android for Cars App Library. The Android Auto app is only available in the google build flavor of the app, and thus its code is located in the app/src/google/java directory under the net.vonforst.evmap.auto package.

This page contains instructions on how to test the Android Auto app using the Desktop Head Unit (DHU).

Further information about testing Android Auto apps is also available on the Android Developers site.

Install the Desktop Head Unit

Refer to the instructions on the Android Developers site to install the DHU 2.0 using the SDK manager.

Install Android Auto

If you haven't already, install the Android Auto and Android Auto for phone screens apps on your test device from the Google Play Store.

If you are using the Android Emulator, the Play Store may show the Android Auto app as incompatible. In that case, download the APK for the newest version from a site like APKMirror (choosing the correct architecture for your emulator - x86_64, x86 or ARM) and drag it onto the running emulator window to install.

Starting the DHU

(see also the corresponding section on the Android Developers site)

  1. Start the Android Auto for phone screens app, tap the menu icon on the top left to go to settings
  2. Scroll all the way down to the app version, tap it 10 times
  3. Click OK in the dialog that appears to enable developer mode
  4. In the menu on the top left, tap Start head unit server
  5. On your computer, run the following command to set up the required port forwarding:
    adb forward tcp:5277 tcp:5277
  6. Start the DHU by running the command desktop-head-unit.exe (on Windows) or ./desktop-head-unit (on macOS or Linux) in a console window from the SDK_LOCATION/extras/google/auto/ directory.

The desktop head unit should appear and show the Android Auto interface. If this is the first time the Android device is connected to the DHU, you may need to open the Android Auto app again on the phone to accept some permissions before the connection can succeed.

Testing EVMap on the DHU

Make sure that you have selected the googleDebug variant in the Build Variants tool window in Android Studio (the foss variants do not contain the Android Auto app). Then, install the app on your phone - if the DHU is connected, the app should also automatically appear in the apps menu on Android Auto.

For testing features that require car sensors, you need to start the DHU with the option -c config/default_sensors.ini to select a configuration file that enables these sensors. From the console, you can then type certain commands to update the data of these sensors, such as:

location 54.0 9.0     # latitude, longitude
fuel 50               # percentage
range 100             # in kilometers
speed 28              # in m/s