5,594,077 Members 46,559 Now Online
XDA Developers Android and Mobile Development Forum

[APP][2.0+] Toggle2G (Tasker/LTE/Rootless) [v0.3.5 / 1/13/2013]

Tip us?
 
TheMasterBaron
Old
(Last edited by TheMasterBaron; 17th January 2013 at 01:15 PM.)
#1  
TheMasterBaron's Avatar
Recognized Developer - OP
Thanks Meter 514
Posts: 496
Join Date: Jan 2009
Location: Denver, CO

 
DONATE TO ME
Default [APP][2.0+] Toggle2G (Tasker/LTE/Rootless) [v0.3.5 / 1/13/2013]

I've made a java application to take "any" flashable ROM zip and resign the zip and inject Toggle2G into it. Check the downloads for ResignUpdate.zip. Check the readme-first.txt in the zip for more information. Works with Windows/OSX/Linux with java installed

Here is a little app I've started working on that enables the 2G Only setting automatically when the phone is asleep to save battery.

As always with these kinds of things, I am not responsible if something goes wrong, so use at your own risk.

Working on Android versions since 2.1. I'm using it on my Nexus 4.

Installation:
The flashable Toggle2G-Update.zip is designed to work with CyanogenMod based ROMs. There is no need to resign any CyanogenMod ROMs.
The easiest way to see if Toggle2G works on your ROM is flash the Toggle2G-Update.zip from the recovery. If your ROM is compatible, Toggle2G will show up in your app drawer.
ONLY IF THAT DOES NOT WORK, then you can try the ResignUpdate java application to convert your ROM. ROMs must be in zip form and be flashable through a recovery like CWM or TWRP. Download the ResignUpdate.zip and read the included readme-first.txt file. Once you resigned your ROM, you then wipe and flash the resigned ROM.
See the troubleshooting section below if you have trouble.


ResignUpdate Change Log:
v3.0.1 - Don't close out of the GUI on certain errors
v3.0.0 - Automatic SecPhone.apk and SecSettings.apk detection | Running ResignUpdate.bat/sh without any parameters pops up a GUI so you can pick the ROM.zip file (Should help with path issues). You can still use the command line options if you want and it will bypass the GUI.
v2.1.3 - Update Toggle2G.apk to v0.2.0.
v2.1.2 - Overrides ROM's Toggle2G.apk when injecting.
v2.1.1 - Bug fix during Toggle2G.apk injection.
v2.1.0 - ZipAlign resigned files.
v2.0.4 - It seems keys need to be physical files..fixed
v2.0.3 - Don't fail on unreadable apks. Sign resigned zip. Move injection files into ResignUpdate.jar so no path issues.
v2.0.2 - Better detection of RSA file in an APK. Some additional optional parameters to help with any fringe cases that might come up
v2.0.1 - Don't change apk's storage method when processing it
v2.0.0 - Initial Release

Toggle 2G Change Log:
Always reboot after an update!
v0.3.5 Added option to always switch to 3G. This is if you want 3G except when on wifi or data off or low battery. / Fixed Spanish translation crashing Toggle 2G. / Start to refer to networks as fast/slow. This is because users might want to toggle from LTE to 3G.
v0.3.4 Fixed bug that was switching back to 3G
v0.3.3 Enable data in auto swich mode will reactive 3G
v0.3.2 Fix retry of network change when data off setting is used
v0.3.1 Fix bug when toggling data that was preventing the Manual Notifications from working.
v0.3.0 Added LTE networks and removed the need for ROOT (You will need to re-setup Toggle2G after upgrade)
v0.2.4 New icons from LeopardSurd. Show version number at top of Toggle 2G settings screen.
v0.2.3 Try for 5 seconds to get network to switch after data turning off data. I hope this helps with switching on phone like the Galaxy S II; German translation thanks to Aiakio; Italian translation thanks to krinet
v0.2.2 Fixed bug where sometimes network would switch to the same network causing data to disable then enable
v0.2.1 Fix some issues with not switching.
v0.2.0 Option to wait for phone unlock before switching to 3G; Option to turn data off to switch networks; Option to switch to 2g when data is off; French translation thanks to mooondark
v0.0.20 Set SDK to v8 to fix compatibility with CM6
v0.0.19 Updated German using the translation from Aiakio.
v0.0.18 Added translations by muchopoli83. (Danish, German, Spanish, French, Hungarian, Italian, Portuguese, Russian, and Chinese)
v0.0.17 Tweaked chmod on preferences folder
v0.0.16 Switch to 2g when data is disabled. Better fix for bug where settings are not surviving a reboot.
v0.0.15 Fix bug where settings are not surviving a reboot (I hope). New icon from hawkeyexp, thanks!v0.0.14 2G when sleep on/off option, 2G Notification fixes/options, Options reworked
v0.0.13 Option to not switch to 2G if network is being used. Default threshold of 2 KBps means 2G will not enable if >= 2 KBps is being used. Threshold is configurable in settings
v0.0.12 You can pick a specific network through the Tasker/Local plug-in (not just 2G or 3G) / Battery feature can be turned off / Disable options only applicable to auto manage when its off
v0.0.11 Delay switching to 2G when wifi is turned on to prevent network outage during transition. Also added option to off the feature that switches to 2G when using wifi.
v0.0.10 Fix bug that was not changing auto manage
v0.0.8 Customizable network selections for 2G and 3G modes.
v0.0.7 Added home widget. The Toggle 2G plug-in app is needed to use the widget.
v0.0.6 Option to allow user to choose when to switch back to 3G using the notification bar. Requires a separate plug-in app attached here or from the market
v0.0.5 more fixes to try and prevent switching when phone rings and phone wakes up
v0.0.3 fix issues with disconnecting incoming call
v0.0.2 adds Tasker/Locale plugin support!

Automatic Mode Features:
  • Switch to 2G when wifi is connected.
  • Switch to 2G when data is turned off.
  • If screen is off for more that 10 minutes (configurable in the app) it will switch to 2G
  • If screen is off and battery is below 30% (configurable in the app) it will switch to 2G
  • Network usage monitoring to prevent switching to 2G if network is being used.
  • 3G can be re-enabled as soon as the screen is turned on or unlocked or it can be done manually
  • Option to Disable data before switching network. (Required on some phones/ROMs)
  • Option for manual switching back to 3G. This setting allows user to choose when to switch back to 3G by selecting a notification in the notification bar. Requires separate app located on market or use link below

Notes:
  • Runs in the com.android.phone process to gain access to the 2G Only setting.
  • Shares process with system so installing will list pretty much all of the permissions
  • Uses root access to save preferences, seems running in the com.android.phone process can causes some problems with creating a preferences folder to hold the preferences file. Root access is needed to save preferences. I have a new system for saving preferences that does not need root. However, as a backup, if Toggle2G fails to use the new system it will fall back to this old system and use Root, (I didn't want to break it for phones I can't test on)
  • Does not change network while in a call. Otherwise the call will drop because the radio resets. (Even if Tasker/Locale tells it to)
  • Changing network can be slow. You may have to wait a second for 3G to reactivate. I suggest using the manual switch to 3G option and plugin if this is the case.
  • Due to issues with how Toggle 2G uses a shared user id, I've implemented the notifications and home widget under a separate app.
  • 3 settings for the Tasker/Locale plugin and home screen widget. Automatic, 2G , or 3G (Setting 2G or 3G disables auto mode)

ToDo:
  • Don't switch to 2g while tethering
  • disable the 3g when the reception is between ___ and ___ to keep it from flip-flopping. (Can't be done, you can't monitor 3G reception levels while in 2G)
  • Use g sensors to detect movement and reactivate 3G to lower radio down time after unlocking phone (Monitoring these sensors would drain battery and defeat the purpose)

If you think of a feature or find a bug, let me know.

Also, I've attached a values.zip file so that everyone can contribute to translating Toggle2G to other languages.

I'm a code junkie, please support my habit


SOURCE CODE IS AVAILABLE HERE:
Toggle 2G Source
Toggle 2G Plugin Source

TROUBLESHOOTING
* Make sure you have Java 6 or higher installed
* I get an "Failed to find any apk with a key" error when signing my ROM
 
If you get this error it means that ResignUpdate tool could not find one of these files in the ROM's zip file:
  • system/app/phone.apk
  • system/app/settings.apk
  • system/app/SecPhone.apk
  • system/app/SecSettings.apk
At lease one of these files is needed to identify what in the ROM needs to be resigned. You can open the ROM's zip file and try and find where one of these files are. If you find it in a folder other than system/app you can specify one of these files in the -keyapk parameter when running ResignRom. For example, if you find that the SecPhone.apk is actually in the preload/symlink/system/app folder, then put preload/symlink/system/app/SecPhone.apk in the -keyapk parameter.



Cheers!
Master Baron
Follow me
Attached Thumbnails
Click image for larger version

Name:	screenshot.JPG
Views:	125398
Size:	82.7 KB
ID:	1516973  
Attached Files
File Type: zip values.zip - [Click for QR Code] (20.8 KB, 1783 views)
File Type: apk Toggle 2G Notification Plugin.apk - [Click for QR Code] (63.0 KB, 9063 views)
File Type: apk Toggle2G-v0.3.5.apk - [Click for QR Code] (82.4 KB, 13761 views)
File Type: zip Toggle2G-v0.3.5-Update.zip - [Click for QR Code] (171.7 KB, 12495 views)
File Type: zip ResignUpdate-v3.0.1-Toggle2G-v0.3.5.zip - [Click for QR Code] (254.5 KB, 5616 views)
T-Mobile: Galaxy S 4
Old Devices: Nexus 4, Galaxy S II, G2x, Nexus One, G1

Check out my XDA projects:I'm a code junkie, please support my habit by donating
The Following 226 Users Say Thank You to TheMasterBaron For This Useful Post: [ Click to Expand ]
 
THATTON
Old
#2  
THATTON's Avatar
Senior Member
Thanks Meter 41
Posts: 1,150
Join Date: Aug 2007
Location: Bakersfield
Quote:
Originally Posted by TheMasterBaron View Post
OK, so here is a little app I've started working on that enables the 2G Only setting automatically when the phone is asleep to save battery. It's not polished at this point, just trying out the features and come up with more to add.

** REQUIRES CyanogenMod 6 **

Notes:
  • Signed using the CM6 platform.x509.pem so not sure what other ROMs it will work with.
  • Runs in the com.android.phone process to gain access to the 2G Only setting.
  • Uses root access to save preferences, seems running in the com.android.phone process can causes some problems with creating a preferences folder to hold the preferences file. Root access does a mkdir to make the preferences folder and that is all.
  • Does not change the 2G Only flag while in a call. Otherwise the call will drop because the radio resets
  • Changing the 2G Only flag can be slow. You may have to wait a second for 3G when turning the screen on after it has switched to 2G while the phone was asleep

Features:
  • It doesn't bother switching to 2G if phone is plugged in
  • It doesn't bother switching to 2G until wifi disconnects
  • If screen is off for more that 10 minutes, it will enable 2G Only setting
  • If screen is off and battery is below 30% (configurable in the app) enable 2G Only setting
  • 3G is re-enabled as soon as the screen is turned on unless battery is below configured percentage

Install the apk then reboot the phone.

After reboot, run the Toggle2G app to enable the service and configure the low battery %

ToDo:
  • Widget to switch between Auto, 3G and 2G.

If you think of a feature or find a bug, let me know.

Enjoy!
Master Baron

This could be awesome!!! I think this should probably go in the themes and apps section though. Thank you for this. I will test it out now.
 
bimmerd00d
Old
#3  
bimmerd00d's Avatar
Senior Member
Thanks Meter 96
Posts: 692
Join Date: Jan 2008
Quote:
It doesn't bother switching to 2G until wifi disconnects

I think i read this wrong, you mean it switches to 2G once wifi is connected?
Mine: LG G2 (Sprint)
Wife: Samsung Galaxy S4 (Sprint)
Backup: Galaxy S3,

For Sale: AT&T Galaxy S3 blue, GSM Galaxy Nexus...PM me if interested.
 
massari90
Old
(Last edited by massari90; 30th July 2010 at 04:30 AM.)
#4  
Senior Member
Thanks Meter 5
Posts: 101
Join Date: Dec 2009
Quote:
Originally Posted by bimmerd00d View Post
I think i read this wrong, you mean it switches to 2G once wifi is connected?
That would be good if its this case..

Testing now anyway. Will let you know if it works. Widget would be awesome to switch from 2g to 3g to auto
 
piggie916
Old
#5  
Member
Thanks Meter 0
Posts: 59
Join Date: Nov 2009
I agree, a widget would be amazing! Also a adjustable timer for when the screen goes off.
 
galaxys
Old
#6  
galaxys's Avatar
Senior Member
Thanks Meter 458
Posts: 7,506
Join Date: May 2007
Location: Vegas & Cosmos
Sweet! Something I've dreamed about
LGNexus5 <LGNexus4sold <HTCSensationsold <HTCNexus1sold <HTCHermessold <LG5250sold <MotorolaStarTacvault.
The XDA Cheerleaders hope your devices are winners! Happy Flashing!

Galaxys Enterprises: Fashion is a Passion - Life in the Cardio Fast Lane - High Energy Techno Mix - Reach for the Universe!
The Following User Says Thank You to galaxys For This Useful Post: [ Click to Expand ]
 
bimmerd00d
Old
#7  
bimmerd00d's Avatar
Senior Member
Thanks Meter 96
Posts: 692
Join Date: Jan 2008
Locale plugin would be utterly awesome. If i could make this thing autoset 2G when i go to bed or whatever other conditions i choose, that'd make this thing complete.
Mine: LG G2 (Sprint)
Wife: Samsung Galaxy S4 (Sprint)
Backup: Galaxy S3,

For Sale: AT&T Galaxy S3 blue, GSM Galaxy Nexus...PM me if interested.
 
massari90
Old
#8  
Senior Member
Thanks Meter 5
Posts: 101
Join Date: Dec 2009
Quote:
Originally Posted by piggie916 View Post
I agree, a widget would be amazing! Also a adjustable timer for when the screen goes off.
Yea adjustable timer should be implemented. 10 minutes takes to long to test
 
TheMasterBaron
Old
#9  
TheMasterBaron's Avatar
Recognized Developer - OP
Thanks Meter 514
Posts: 496
Join Date: Jan 2009
Location: Denver, CO

 
DONATE TO ME
Quote:
Originally Posted by bimmerd00d View Post
I think i read this wrong, you mean it switches to 2G once wifi is connected?
Unless I'm wrong, it doesn't appear that the 2G/3G radio is on when wifi is on, so it doesn't bother switching it from 3G to 2G because it resets the radio and I didn't want it to do that if it didn't matter. So basically, when wifi is on and connected, it never switches to 2G when the phone is asleep until wifi finally disconnects.

Adjustable timer is next and the Locale plugin is a great idea.
The Following 2 Users Say Thank You to TheMasterBaron For This Useful Post: [ Click to Expand ]
 
cdw9800
Old
#10  
cdw9800's Avatar
Senior Member
Thanks Meter 51
Posts: 659
Join Date: Dec 2007
Location: Bay Area
hmm this could be a very useful app 10 minutes is a while to wait and see if it works
went home (Back to HTC) HTC One M8..now if they made a premium windows phone ...



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes