Periodic Location Update question

Post your questions and help other users.

Moderator: Martin

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Periodic Location Update question

Post by mechrekt » 25 Oct 2013 14:59

If I use the trigger "Periodic Location Update" with "Network" Location Provider to see if certain WiFi signals are available, can I leave WiFi toggle OFF? Can I expect that Automagic turns on and off the WiFi toggle just to check the WiFi signal or I must "automate" this process by myself?

Sorry for my english...
Thank you for this magic app!

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Periodic Location Update question

Post by Martin » 25 Oct 2013 15:42

Hi,

The trigger Periodic Location Update does not automatically turn wifi on/off. Starting with Android 4.3 your phone can use the wifi scan results to determine your location when 'Scanning always available' is turned on in the system settings->Wi-Fi->Advanced. On older Android versions you have to build a flow that periodically switches wifi on/off and then updates the location.

Regards,
Martin

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Periodic Location Update question

Post by mechrekt » 25 Oct 2013 16:01

It's perfect.

Thank you.
Regards

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Periodic Location Update question

Post by mechrekt » 25 Oct 2013 21:35

So, what is the right way to use Periodic Location Update (for wifi only) in combination with WiFi on/off toggle?
I want to have my WiFi always off and activate it only when Periodic Location Update is running, so I think I can not use Periodic Location Update as trigger because it comes at start, before I can turn the WiFI on.
I think I must use Periodic Time trigger, then Set Wifi State On action, then Location Condition (or WiFi available condition) to know where I am, then Set Wifi State Off action, then do some actions for that specific Location.

Is that correct? Is that a battery saving solution?

For now I want to know the exact way to do this, then I want to combine this with Perdiodic Location Update (mobile cells)

thank you in advance

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Periodic Location Update question

Post by Martin » 26 Oct 2013 08:24

Following flow should work but it might need some tweaking for your device/region:
-trigger Periodic Timer Inexact: ~every 15m or Periodic Timer: every 15m
-action Set WiFi State: On
-action Init Variable Location: new location ... Network use minimum accuracy to ignore inaccurate locations determined by cell towers
-action Set WiFi State: Off
-condition Location: in ...
-->true -action Notification on Screen: currently at X
-->false -action Notification on Screen: currently NOT at X

Increase the interval of the trigger to the highest acceptable value to save battery.

Using the condition WiFi Available uses almost no battery and should be preferred when the SSID is known and you don't need the coordinate of the location:
-trigger Periodic Timer Inexact: ~every 15m or Periodic Timer: every 15m
-action Set WiFi State: On
-action Sleep: 10s
-condition WiFi Available: <ssid>
-->true -action Notification on Screen: currently at X
-->false -action Notification on Screen: currently NOT at X
-action Set WiFi State: Off

Regards,
Martin

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Periodic Location Update question

Post by mechrekt » 26 Oct 2013 11:07

Thank you, now I did this:
-trigger Periodic Timer Inexact: ~every 15m or Periodic Timer: every 15m
-action Set WiFi State: On
-action Sleep: 10s
-condition WiFi Available: <ssidHOUSE>
-->true -action Set Flow State: Enable FLOWHOUSE
-->false -condition WiFi Available: <ssidWORK>
----> true -action Set Flow State: Enable FLOWWORK
---->false -action Set WiFi State: Off

I've 2 questions:
1) can I select a mac address instead of the ssid? (I've several mac address with the same ssid address and I can more precise if I use mac address).
2) I could not find a trigger that simply starts the flows "FLOWHOUS" and "FLOWWORK": these two flows will execute some actions (for example gps off, bluetoot off, etc.) they must simply start (without a trigger because they are called from the "main" "location flow".

THANK YOU!

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Periodic Location Update question

Post by Martin » 26 Oct 2013 13:58

1) The condition WiFi Available provides some variables to the flow when the SSID matches.
It will create a variable bssid containing the mac address of the AP with the strongest signal level and a variable bssids when multiple APs for this SSID are available (see the help page for the full list of variables).
You can use a condition Expression to check if the scan result matches the mac address of interest. For example: condition Expression: bssid=="12:34:56:78:90" or when using the list: Expression: containsElement(bssid, "12:34:56:78:90")
When working with variables it's often helpful to temporarily use a condition Debug Dialog in the flow. The condition will show a dialog with all available variables and the values of the variables. The Yes-button continues the flow on true-branch, the No-button continues the flow on the false-branch.

2) You can execute other flows with action Execute Flows. The flows don't require a trigger but the flow to call must be enabled.

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Periodic Location Update question

Post by mechrekt » 26 Oct 2013 17:34

Martin wrote:2) You can execute other flows with action Execute Flows. The flows don't require a trigger but the flow to call must be enabled.
Let's forget for a moment the point 1 (maybe I'll ask you later).
For now I'm happy with my "location flow" but let me clarify the problem: for every location the flow must launch another specific flow for the specific location (for example "home", "work"..). I know I can do that by "Set Flow State: Enable HOMEFLOW" or "execute flow" actions.
My problem is another: how can I define a flow, for example HOMEFLOW without a trigger at start? The HOMEFLOW has some actions "set wifi state", "set gps state" etc, but not need a trigger at the start of the flow. When I create a new flow a trigger block is placed and cannot be deleted... sorry I'm a little bit confused about that.

tschaedl
Posts: 45
Joined: 28 Feb 2013 22:17

Re: Periodic Location Update question

Post by tschaedl » 26 Oct 2013 19:09

Keep the trigger empty.

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Periodic Location Update question

Post by mechrekt » 27 Oct 2013 07:55

So simple hahaha :-)

Post Reply