• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

infinite loop

oliver

Newbie
I'm using Republic Wireless and for anyone not familiar, all calls/txts go via VoIP unless VoIP is unavailable (no wifi for example) and then it switches to cell.

To save battery, I've been switching to airplane mode when on wifi.

My plan is to have tasker switch me to airplane mode when it detects my phone is registered and back to cell when unregistered (independent of wifi connectivity)

I can find out the status from running 'dumpsys notification' and looking for the tickerText line regarding "Wi-Fi calling"

The only way I see to do this would be via an infinite loop:

(pseudo)
start
dumpsys notification
if calling is "enabled" then airplane mode on
if calling is anything other than "enabled" then airplane mode off
go to start

Do you think the cost of running the loop would kill any benefit of going into airplane mode? To make this worthwhile, I have to run it every 30 to 60 seconds. The risk is missing calls if I'm airplane mode and wifi is up but internet connectivity is down

I assume I can do this all with variables so I don't see it hurting my SD card

Any better methods to accomplish this?

Thanks
 
Once upon a time, I created a similar profile to enable Airplane Mode while connected to wifi with a working Internet connection. I don't use the profile anymore, but I did post about it over at XDA: [GUIDE] Smartphone Service for just $30/month - XDA Forum (scroll down to the "Automatically toggle Airplane Mode when connected to wifi." spoiler section).

Granted, that hasn't been updated in a LONG time (I like posting here a lot more!), but maybe it can be at least a little helpful for you. :thumbup:
 
One quick question on this if you don't mind:

Screenshot_2012-05-10-16-27-43.png


if %HTTPR does not equal -1, it does steps 3, 4 and 5

if %HTTPR does equal -1, it does steps 7 and 8

For the first scenario (where it does equal -1) how does it loop back if step 8 is inside the 'else' part?

Wouldn't it have to be outside or am I looking at this wrong?
 
It depends on how the task is triggered. What is the context of the profile?
 
Back
Top Bottom