DriverDistractionException when registering multiple clients to the DriverDistractionAPI

106 views Asked by At

I'm developing an App for the DispoPilot.guide and the FleetBoard Store and try to access vehicle data. My App consits of a UI with several activities and some services which should handle the vehicle data. When I register my activity and my service to the driver distraction API I get a DriverDistractionException for the second client I'm registering. What is wrong with my code?

I'm using

DriverDistractionClient.INSTANCE.connect(this, this);

in both my activity and my service.

1

There are 1 answers

0
Tobias Amon On BEST ANSWER

It is not allowed to connect the client (your application) multiple times to the API. You can only have one callback for the API. If notification of multiple listeners is desired, this must be handled separately. This can be done by implementing the IDriverDistractionClientCallback interface which then accepts multiple callbacks.