Wednesday, July 10, 2019

Network mode switch quick settings tile


I have a bootleggers ROM (Android 9 pie) installed on a Motorola Moto E 2015 phone. Can I add a quick settings tile that would switch between 2G only and 2G/3G/4G network modes?


In Lineage and ResurrectionRemix ROMs there is an "LTE" tile, which can achieve this, I think. But Bootleggers rom doesn't have it. I solved this with Shortcutter app, but it opens a list of network modes every time, so I have to click twice instead of once. Ideally, the tile should switch between these two network modes and display the current mode.



Answer



For everything you want to automate on your Android phone I highly recommend you to use Automate. Automate is a powerful visual scripting app. Imagine it to be the BluePrints for Android. Or should you know Scratch, it's just like that. Changing default Network Type is a system setting you can easily do using Automate.


Automate offers the "Quick Settings Tile Show" block that sets up an QS Tile and can be interacted with. For use of that block, refer to https://llamalab.com/automate/doc/block/quick_settings_tile_show.html


This app is an scripting app. This means you still have to create your program according to your wishes, but I suppose that should not be a problem for you. https://llamalab.com/automate/


Your script will look like this: CODE PICTURE


At first you need to set your preferred network type. Let's go with LTE here. You pick the "System Settings Set" Block, choose "Network Preferrence" and enter LTE. Note: The actual value your system uses to express "LTE" may vary from device to device. To find out which term YOUR device uses, you can utilize the "System Setting Get" block: In your settings, set LTE as preferred network. Then, within Automate, you use the System Setting Get block and ask for the current preferred network. You assign the block output to a variable (You don't need to manually create one. A variable with the name you enter will be created automatically), for example "Type". Then, you pick the "Toast Show" Block, and enter the name of the variable. Note: Automate uses text as primary input. You can change between these modes by clicking the "fx" icon right next to the input field. Variable and Text Input


It will change into a Stamp then. Text always has these "" around them, while variables don't. When entering the variable into the Toast Show block, be sure to switch into Variable input mode and enter the name of your variable without these "".



When you have found out how your device calls "LTE" in the settings, go back to our original script. Here you can add it to the System Setting Set block.


So far, our script has two blocks: The Flow Start and System Setting Set block. Now we add the Quick Settings Tile. For that, you pick the Quick Settings Tile Show block and set it up according to your wishes. For example you can call it LTE, choose an appropriate Icon and make it "Active".


Now, add another System Settings Set block, that changes the network preferrence to whatever you want to have instead, for example EDGE or WDCMA. To find out by which name your system calls these network types, you can recycle the "System Settings Get - Toast Show"-Script.


And then, once again, put another Quick Settings Tile Show block with the same input arguments, except for the "Active" button, which should be left inactive this time.


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 ...