0

I have a Samsung Galaxy S4 Mini, powered by CyanogenMod 13 (Android Marshmallow 6.0.1), which I use as Wi-Fi only, being it without SIM card.

The device antenna, though, seems to be constantly connected to a cellular tower, so I'm afraid that this fact may result in an increased battery consumption (even if slight, that is). Plus, I don't want my position to be triangulated due to this behaviour.

Simply dialing *#*#4636#*#* and disabling the antenna from there seems to suffice, but the change does not persist between reboots, and repeating all of the procedure each time is a nuisance.

What I wish for, is a way to make the abovementioned change persistent, without the need for a whole app, which I deem overkill for such a simple task. Even better, I favor a solution that makes use of the built-in Terminal, be it a single command or a function, and I'm open towards solutions that require root access.

Is there such a way to accomplish this?

0

Use airplane mode to disable the cellular radio. This is simple and does not require an app, use of terminal, or root access.

  • Of course it will work, but then I'd have to manually turn on the Wi-Fi, won't I? – Death Mask Salesman Aug 18 '16 at 13:39
  • Just tested it to be sure: just enabling airplane mode leaves the No SIM Card on the notification bar, as well as obviously placing the Airplane icon. Surely it works, but it has its downsides. Thanks for answering! – Death Mask Salesman Aug 18 '16 at 13:45
0

As of now, I've found a way to accomplish what the question asks. This solution has been tested on CyanogenMod 12.1 and 13.


From the Terminal

Disabling RIL

If the operation is not to be performed frequently, a single line of code will be all that is needed:

su -c "setprop persist.radio.noril 1"

. This will make the phone ignore the Radio Interface Layer, thus ignoring the presence of the antenna. A reboot is required for the change to be in effect, and it will persist across reboots.

Plus, disabling RIL also makes the "No SIM Card icon vanish.

Enabling RIL

Enabling RIL again is just a matter of flags. As can be seen from the below example:

su -c "setprop persist.radio.noril 0"

, the command is equivalent, save for a 0 instead of a 1. As before, a reboot is needed.


As a custom function

I've also devised two functions to be added to the /system/etc/mkshrc file. Of course, it's usually needed to remount the /system partition as read-write, but the procedure will not be covered in this answer.

This file takes care of various environment variables and aliases to be loaded by the Terminal once it is started, so fiddling with it is often discouraged. We can, though, add our personal functions and customizations just before the line that reads:

: place customisations above this line

. I would like to remind that : is a special shell builtin, and thus must be left untouched.

Disabling RIL

Here, we'll define a custom function radiooff, which will next be callable from the Terminal at will. The code is as follows:

# This function detaches a device from the cellular network
# Upon execution, a reboot must be performed
function radiooff {
 if [ "$(whoami)" != "root" ]; then
  echo "Error: must be executed as root."
  return 1
 fi

 if [ "$(getprop persist.radio.noril)" == "1" ]; then
  echo "Radio is already disabled."
  return 1
 fi

 setprop persist.radio.noril 1

 if [ "$(getprop persist.radio.noril)" == "1" ]; then
  echo "Radio is now disabled. Please reboot."
  return 0
 else
  echo "Error: unable to disable radio."
  return 1
 fi
}

. I'd like to remind that it's vital to place this code at the bottom of the file, but above the line mentioned at the start of this section.

Enable RIL

This function, as the comments explain, is the inverse of the radiooff function:

# This function connects a device back on the cellular network
# Upon execution, a reboot must be performed
function radioon {
 if [ "$(whoami)" != "root" ]; then
  echo "Error: must be executed as root."
  return 1
 fi

 if [ "$(getprop persist.radio.noril)" == "0" ]; then
  echo "Radio is already enabled."
  return 1
 fi

 setprop persist.radio.noril 0

 if [ "$(getprop persist.radio.noril)" == "0" ]; then
  echo "Radio is now enabled. Please reboot."
  return 0
 else
  echo "Error: unable to enable radio."
  return 1
 fi
}

. Upon saving the modifications, the functions radioon and radiooff will become available for use after the CyanogenMod Terminal application is started, or restarted. The procedure for using them is simply to enter the name of the needed function and enter.

It may be obvious, but the second solution will not work if the user uses a Terminal that is not CyanogenMod's.

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.