Wednesday, January 2, 2019

settings - Simple way to toggle between 2G and 3G connection


TL;DR


Usually, I have my device locked to "2G only" for multiple reasons:



  • saving

  • no need for "high-speed" to simply be informed about new mail or doing the little contacts/calendar syncs (not much changes, either)


But from time to time, I could use 3G:




  • some area that has bad 2G coverage (data-wise)

  • the occasional "internet use" e.g. with a navigation app, looking up "a little more" on the web, or installing something from


For those occasions, I find it impractical to navigate to the settings page and change that manually -- even when done via some "shortcut" placed on a . Preferably, I want to be able to automate this via , to e.g. automatically switch when entering/leaving the "bad coverage area" or when one of those apps is in foreground (both conditions are covered by tasker, just the "action" is missing). I checked thoroughly on our site here, on the , and even did an extensive Google search -- but all that turned up was either a shortcut or a kernel patch for specific ROMs, both no-gos for me.


Hence my...


Question:


Is there any easy way to switch between 2G/3G mode? As said, shortcuts to the settings page do not count (so Can anyone reccomend a 2g / 3g switching widget? is no option). Wanted criteria include:



  • not requiring more than one tap (preferably no tap to trigger the action, see below)


  • a big plus (and favorite wish): ability to be triggered via

  • not depending on specific ROMs (should work with )

  • preferably not involving -- but options requiring root would still be fine with me

  • hacks are fine with me as well :)



Answer



With Xposed module and Gravity Box installed, the pull down status bar can be customised even on stock ROM (of course it has to be rooted).


I have a Nexus 5 running stock 4.4.4 and following is how it looks: enter image description here


With these installed, one can swipe down with two fingers from top and just tap the last tile shown as "3G" in the image. Though this nearly misses the first requirement of using no more than one tap, technically it still does as you have swipe down and use one tap. enter image description here


That tile toggles between 3G, 2G, 2G3G states. There is a minor lag to see the signal strength tile to reflect the status as "H+" or "E".



By installing the Gravity Box, I was also able to bring in the additional tiles like "Torch On/Off", "Auto Rotate Lock" etc which were not available in the stock ROM.


Update: Thanks to jsen who was kind enough to share an intent to switch between 2G and 3G using Tasker and Gravity Box (that implies Xposed framework and rooting).


To avoid a dead link in future, the content of that Tasker hack is as below:


Send Intent [
Action: gravitybox.intent.action.CHANGE_NETWORK_TYPE
Cat: None
Mime Type:
Data:
Extra: networkType:1
Extra:

Package:
Class:
Target: Broadcast Receiver]

networkType enum values are:
0: WCDMA Preferred
1: GSM only <-- This would be "2G" on GSM networks
2: WCDMA only <--WCDMA is "3G" on GSM networks. You may know it as HSPA
3: GSM auto (PRL)
4: CDMA auto (PRL)

5: CDMA only <-- This would be "2G" on CDMA networks
6: EvDo only <-- EvDo is "3G" on CDMA networks
7: GSM/CDMA auto (PRL)
8: LTE/CDMA auto (PRL)
9: LTE/GSM auto (PRL)
10: LTE/GSM/CDMA auto (PRL)
11: LTE only
12: "unknown"

In my office, I have very bad 2G signal which drops my call very frequently. Hence I used to switch to 3G when I reach office. I created an entry task named "Enable 3G" and an exit task named "Enable 2G" which just sends intent as above. With Tasker's "Cell Near" state I can ask Tasker to enable 3G when I am near office and switch back to 2G while leaving.



No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...