1

I have experience with Android automotive and i was able to receive PropertyIds like handbrake, rpm and other stuff perfectly.

Now i want to do the same with Android Auto only, i know it's possible because Waze do it perfectly, it detects the state of the handbrake, now the question is how ?

I mean what feature should i check for running PropertyManager and Car library properly ?

Here is an example of code that works on Automotive but not on Android Auto :

car = Car.createCar(context);

it crash on Android Auto :

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/car/Car;

    at com.tib.androidautotest.CarPropertyHelper.startCan(CarPropertyHelper.java:37)

    at com.tib.androidautotest.CarPropertyService.onCreate(CarPropertyService.java:39)

    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4379)
                                                                                                                              

I think that's normal cause Android Auto does not have car library (i guess), but what should i do for accessing PropertyIds ?

d.cruveiller
  • 113
  • 7

1 Answers1

0

Yes, the android.car library is only available on Android Automotive OS (see Can't use Android Auto 'android.car' library - throws RuntimeException: Stub). For Android Auto, the only way to read car hardware information/state is via the CarHardwareManager's CarInfo and CarSensors classes (https://developer.android.com/training/cars/apps#car-hardware). As such, there isn't currently a way to get handbrake state or RPM info on Android Auto (at least not without requiring the user to have a paired OBD II reader and communicating with that directly).

Ben Sagmoe
  • 440
  • 2
  • 9