1. Download our Official Android App: Forums for Android!

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

Discussion in 'Android Help' started by dewb123, Aug 9, 2016.

  1. dewb123

    dewb123 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 9, 2016

    Aug 9, 2016
    2
    0
    5
    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.
     

    Advertisement

  2. AZgl1500

    AZgl1500 Android Expert
    Rank:
     #43
    Points:
    618
    Posts:
    6,400
    Joined:
    Feb 3, 2011

    Feb 3, 2011
    6,400
    3,144
    618
    Male
    Retired and loving it.
    Oklahoma grasslands
    MacroDroid to the rescue.

    Trigger: Power Connected/Removed
    Action: Kill background app



    You can select as many apps as you want to be killed all at once.
     
  3. dewb123

    dewb123 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 9, 2016

    Aug 9, 2016
    2
    0
    5
    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?
     

Share This Page

Loading...