Shake detection

Post your questions and help other users.

Moderator: Martin

Post Reply
slypandemia
Posts: 2
Joined: 14 Sep 2016 16:07

Shake detection

Post by slypandemia » 14 Sep 2016 20:47

Hi, I'd be grateful for some help with this...

I have a flow that triggers when my car bluetooth is connected, it pops up a yes/no dialog asking if I want to start playing podcasts. That works fine, but I want to replace the dialog with a shake detection, eg if I shake the phone within 30 seconds of it connecting, start the podcast player.

I don't see a shake condition anywhere, only a trigger, so currently I have this:

In flow1;
global_shook = 0
enable flow2
sleep 30s
disable flow2
if global_shook == 1 play podcasts

In flow2;
trigger - shake
global_shook = 1

This seems overcomplicated, and also it always waits the full 30s whereas I would prefer it to start playback as soon as the shake gesture is detected.

Is there a better way?

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Shake detection

Post by MURTUMA » 14 Sep 2016 22:14

In flow1;
enable flow2
sleep 30s
disable flow2

In flow2;
trigger - shake
Action to start the podcast.
Disable flow2.


This would be one way to do this. Whether this is better solution that yours depends on how you have built the flows as whole. If they're as simple as in your example, then this might work better.

slypandemia
Posts: 2
Joined: 14 Sep 2016 16:07

Re: Shake detection

Post by slypandemia » 15 Sep 2016 20:00

Thanks, actually that works really well for me.

Post Reply