Click here to Skip to main content
16,022,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Scenario:
The Android and OBD2 devices are paired, and the app is in a state where the task is killed (the process is not completely dead). For example, when you get into the car, the OBD2 and the Android device start connecting without using the app, and this connection is detected by a broadcast receiver, which then starts the service via the app.

There is an app in the market that works this way. How is this implemented?

Since no notifications are received, it does not seem like a foreground service is always running.

Questions:
When the OBD2 device is powered on, does the automatic connection between the Android device and OBD2 depend on the settings of the OBD2 device? Is it possible to achieve an automatic connection during the initial connection flow via the app, so that the devices connect automatically thereafter?

Since Android 12, when starting a foreground service from the background, a ForegroundServiceStartNotAllowedException occurs. I also want to know how to handle this issue.

What I have tried:

Since the OBD2 device is already paired, I thought it would automatically connect with the OS without needing the app. However, after killing the app task, the OBD2 did not reconnect.

I want to create an app that allows the OBD2 and Android device to start connecting when I get into the car, without using the app. I don't know how to achieve this. Please help.
Posted
Updated 17-Jun-24 22:01pm
Comments
David Crow 18-Jun-24 8:43am    
"I want to create an app that allows the OBD2 and Android device to start connecting when I get into the car, without using the app."

If the two devices have been paired, them auto-connecting should be handled automatically by the phone's OS, correct?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900