Detecting Driving

General discussions about Automagic and automation in general

Moderators: MURTUMA, Martin

Posts: 7
Joined: 13 Dec 2017 20:56

Detecting Driving

Postby piz » 23 Oct 2018 17:25

I want to trigger certain flows when I start/stop driving. It's not clear to me how to do that. Can anyone help?

Thanks!

User avatar
Posts: 318
Joined: 21 Oct 2017 13:36
Location: The Netherlands

Re: Detecting Driving

Postby digitalstone » 23 Oct 2018 18:43

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?
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
Posts: 15
Joined: 22 Oct 2018 10:41

Re: Detecting Driving

Postby Helios » 24 Oct 2018 12:14

Hi,

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".

Posts: 7
Joined: 13 Dec 2017 20:56

Re: Detecting Driving

Postby piz » 24 Oct 2018 18:19

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.

User avatar
Posts: 1322
Joined: 21 Jul 2017 18:50

Re: Detecting Driving

Postby Desmanto » 24 Oct 2018 18:46

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.
Index of Automagic useful thread List of my other useful posts (and others')

Posts: 26
Joined: 05 Aug 2015 18:55

Re: Detecting Driving

Postby xdauser » 27 Oct 2018 11:31

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.

Posts: 3
Joined: 30 Oct 2018 19:03

Re: Detecting Driving

Postby akela » 02 Nov 2018 16:44

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.

User avatar
Posts: 1322
Joined: 21 Jul 2017 18:50

Re: Detecting Driving

Postby Desmanto » 03 Nov 2018 19:35

@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 :)
Index of Automagic useful thread List of my other useful posts (and others')

Posts: 7
Joined: 13 Dec 2017 20:56

Re: Detecting Driving

Postby piz » 14 Nov 2018 20:54

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!

Posts: 1
Joined: 28 Nov 2018 07:22

Re: Detecting Driving

Postby hanahana » 04 Dec 2018 07:30

I agree with the second comment...
Graduated from Soran University with First Class Degree with Honours in Computer Science

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests