How to store mobile connection status to global variable

Post your questions and help other users.

Moderator: Martin

Post Reply
msiemens
Posts: 6
Joined: 13 May 2013 05:11

How to store mobile connection status to global variable

Post by msiemens » 13 May 2013 05:16

Hi there,
I want to improve the screen off flow. So, when screen is switched off, I want Automagic to remember the stati of WiFi and Mobile Data connection. So when screen turned on, I want to enable only those connection types which have been on when screen was switched off. So I have to store the stati when screen is switched off...
Many thanks in advance
Martin

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

Re: How to store mobile connection status to global variable

Post by Martin » 13 May 2013 08:25

Hi,

You can add conditions to check the state of mobile data:
-condition: "Mobile Datanetwork Enabled"
-->true: -action "Script: global_data_enabled = true"
-->false: -action "Script: global_data_enabled = false"

Restore when the screen is turned on:
-condition "Expression: global_data_enabled"
--> true: action "Set Mobile Datanetwork State: On"
--> false: action "Set Mobile Datanetwork State: Off"

Perhaps you can use the WiFi sleep policy in the Android settings to achieve the same for WiFi: Settings->Wi-Fi->menu->Advanced->Keep Wi-Fi on during sleep: Never.

Regards,
Martin

msiemens
Posts: 6
Joined: 13 May 2013 05:11

Re: How to store mobile connection status to global variable

Post by msiemens » 13 May 2013 11:24

Yeah, that's what I am looking for! Sound pretty simple once you got the concept :-)

Thanks a lot
Martin

Post Reply