Page 1 of 1

Detecting Driving

Posted: 23 Oct 2018 16:25
by piz
I want to trigger certain flows when I start/stop driving. It's not clear to me how to do that. Can anyone help?


Re: Detecting Driving

Posted: 23 Oct 2018 17:43
by digitalstone
The first question you should ask yourself is, what "thing" would let my phone know that i'm going to drive in my car?
Do you hook it up to something like usb?
And would that be at particular times of the day/week?

Re: Detecting Driving

Posted: 24 Oct 2018 11:14
by Helios

maybe your want to have a look into this User Activity Trigger..

If your car has Bluetooth, this is the way to go.

Otherwise, you have to think about your real-life flow. Maybe something like "Wifi Disconnected from Homenetwork" -> "Wait for USB-Car-Charger" -> "We are in the car".

Re: Detecting Driving

Posted: 24 Oct 2018 17:19
by piz
I'm testing flows that detect when the car's bluetooth connects/disconnects, but they go on & off all the time as if it's constantly connecting, disconnecting, and reconnecting. I could use a global variable that gets set to true on the first connect but I can't know which disconnect trigger will be the last one to then set the var to false.

I previously tried detecting the launch/closing of the Android Auto app but got the same behavior: start/stop over and over again.

I'm stymied.

Re: Detecting Driving

Posted: 24 Oct 2018 17:46
by Desmanto
It shouldn't flapping like that. There can be some app interfering with the event. Can you add variable logger script to it to see what is going on during the flapping connect/disconnect? If you can spot the pattern, probably you can know which app is causing it. Of course it must be something related to bluetooth.

If the flapping is unavoidable, you can add trigger buffer to protect against the false trigger : viewtopic.php?f=5&t=7229
You can't prevent the flapping, but you can protect the main flow.

Re: Detecting Driving

Posted: 27 Oct 2018 10:31
by xdauser
If your smartphone has NFC module, then NFC tag is also an option. You just stick it somewhere in the car on the dashboard and just touch with your smartphone any time you enter your car to execute flow of your idea. Personally, I have one sticked onto smartphone holder which is permanently installed in my car, so everytime I put my smartphone into holder appropriate action fires up like starting google maps, music application etc... This is quite convenient and effective.

Another option as already mentioned is triggering by car bluetooth system found. The only disadvantage of this is whenever you are close to your car and not necessarily want to drive, the flow gets triggered regardless.

Re: Detecting Driving

Posted: 02 Nov 2018 15:44
by akela
NFC is a good option. I wish I have NFC on my phone, but I don't.
Another option is to use the "Scan Barcode" action triggered by a shortcut.
I generate my own barcode from online barcode generator websites, then stick the barcode inside my car.
I scan it and it starts all my car specific flows. It's a bit of a manual process, but with habit, it is quite fast and automatic for me.

I also stick another barcode at my office computer. When I come in to work, I scan barcode it, and it starts all my work specific flows.

Re: Detecting Driving

Posted: 03 Nov 2018 18:35
by Desmanto
@akela : I ever thought about the similar concept too, but using QRCode. But cancelled it because why we should open and scan the code again? Just simply use a simple shortcut at home screen to set all the flow state and variables :)

Re: Detecting Driving

Posted: 14 Nov 2018 19:54
by piz
I've been doing more testing and I've found that I might have been misinterpreting what I saw. I now think the triggering is correct for the Bluetooth connect/disconnect and all should be well going forward.

Thanks for the help!

Re: Detecting Driving

Posted: 04 Dec 2018 06:30
by hanahana
I agree with the second comment...