-1

When we go to the area where signal is not reachable, we experience "Emergency calls only" or "No service". But after coming-out from that area we sometime found phone is not receiving signal and still showing "Emergency calls only" or "No service" in-spite of no problem of signal in that area. And in that case I usually do "Flight/Airplane Mode" off-wait-on and phone starts receiving signals again.

So, in order to overcome situation (and also consider a case of network-jam), I think should have some solution like running script that auto refresh signal after every n minutes or an application that provides such function.

So, How can I refresh signal from command-line? (or interested in turning "Flight/Airplane Mode" on and off vial command-line) and how about making script that can do this job as per requirement (for example every 30 minute)?

Also suggest any application available and does such job at specified interval of time.

Note: I use rooted phones

1

I suggest you try an app in this case. For example:

You can use Automate app here.

(Click image to enlarge)

IMG:

  • The block for Airplane mode is available under Connectivity category. (Requires root access.)
  • The Delay block can be traced back to Date & Time.

Configure them as you wish. Make sure to have the flow run in a recurring manner, such as shown in above screenshot. You can also setup a trigger for full automation or manually start the flow.


You can also try Tasker to setup a home screen shortcut or a fully automated profile in Tasker. The task should have the following action at least:

Code → Run Shell

  • Command:

    while true; do
    settings put global airplane_mode_on 1;
    am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true;
    sleep 2;   # requires BusyBox or Toybox installed and available under $PATH
    settings put global airplane_mode_on 0;
    am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false;
    sleep N;    # where N can be any number of (s)econds or (m)inutes or (h)ours. Make sure to use the relevant suffix, such as Ns, Nm or Nh.
    done
    

    Instead of while and sleep command, you can use the Wait and GoTo actions available under Task category.

    The commands are drawn from this answer of DavisNT, re-posted here by Andrew T.

  • tick Use Root

Note that once the task is initiated it would continue to run unless you stop Tasker's service or force stop it or reboot the device.

You can get rid of all the command-line stuff by using Secure Settings with Tasker. It also requires root access however.


MacroDroid is yet another app capable of achieving the task. It has all the relevant actions i.e. to toggle Airplane mode, wait for certain time and run a macro (including current macro) to achieve a loop. Give it a try.

It is to be noted that a home screen shortcut can be made by all the aforesaid apps.

  • Note that I've not bothered to check the battery consumption caused by continuous execution of those tasks. I just gave hints. Pick the ones most suitable to you and tweak them per your environment settings. – Firelord May 24 '16 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.