• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help How do I close an app on sleep, BT d/c, or charge d/c

dewb123

Lurker
Aug 9, 2016
2
0
Hi. I've got a kind of unique situation, so I'll explain it here.

I have a car adapter that sends data through BT to an old phone(a Tablet in future) of mine setup in my truck.
This phone's sole purpose is to display some gauges with the parsed data.

I would like this gauge app to open when the truck turns on, and shut off when the truck isn't on.

Here's what I have done so far:

Got the app "Plug in Launcher" - This will launch OBDLink (the app) whenever the phone starts charging. The phone starts charging when I start the truck, through the cigarette lighter charger. Through the OBDLink App, it will try to connect to the adapter via BT as soon as the app launches. I have OBDLink configured to keep the phone awake while the gauge dashboard is on screen.

So..that far, everything works pretty on point. BUT..when I turn the car off, I run into problems. OBDLink app will pop up saying it got disconnected, asking if I want to reconnect. Since it's on the dashboard screen, it will not allow the phone to shut off, thus killing the battery, unless I manually shut it off.

Even if I manually shut it off, though, the next time the truck fires up, it will power up, and go to the app, which is already running on the screen, thusly not actually restarting it, and not having the app try to connect to the adapter on open, because it's already open.

So..I guess what I need, is to have the OBDLink app close whenever the charging is disconnected. This will force a close on it whenever the truck is off, then the app can open upon charging as it should, and all should work out, I think.

If anyone has any other ideas of how to set this up correctly, or how to solve the last part of forcing the app closed on charging d/c, I would appreciate it. This would be the coolest little setup if it just turned on and off by itself, and worked correctly, heh.
 
Hi. So that seemed to be the perfect fit..but, it isn't saving any of the apps log files. On the MFU, they're saying an app called Tasker can send an intent "octech.mobile.applications.obdlink.SHUTDOWN" to shut it down properly. I see a way to send an intent in macrodroid, but there's about 15 other things to input as well..can anyone help me figure this out with macrodroid?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones