Network mode switch quick settings tile


Question

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.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes