yashsingh1/xdaforums huggingface dataset:
[Tasker Tips & Tricks] karakatp:
I have pro/trial version but I still can't see/find the steps you describe! When I run the app Secure Settings the only options that I have is: Info, Options, System+ & Compact Apps... :confused:

Where is to select plugin or to click Pen/Pensil...:confused:
[Tasker Tips & Tricks] sbcrumb:
All these steps are from tasker not secure settings. Secure settings is just a plugin/add on for tasker.
[Tasker Tips & Tricks] karakatp:
OK now I'am totally confused!!! In Tasker where I found/select the option plugin????:confused:
[Tasker Tips & Tricks] sbcrumb:
This guide is not all that great for tasker beginners . Let me see if I can clarify. I will PM you.
[Tasker Tips & Tricks] Brutal_Master:
Does anyone know of an easy way to see that this is working? Maybe a widget or something that would show 2G/3G information? Currently my phone only shows "LTE" on the cellular data icon but nothing else when LTE isn't connected.... :-/
[Tasker Tips & Tricks] karakatp:
Maybe the developer could make o video tutorial on youtube like others @ Tasker Tutorial Series...This whould be great for all of the beginners!!!
[Tasker Tips & Tricks] byazrov:
I want to put a phone in a mode when it always on LTE and only switches to 2G or 3G for calls. But there's no such setting or an app for this. Because of how mobile operators work phones always go to 3G or 2G when the LTE is not in perfect strength, although even when it has only one or two bars it still is better for internet than 2G or 3G.
[Tasker Tips & Tricks] mrorange4287:
I am on sprint with a nexus 6 on 6.0.1 and here are the values I found that change the preferred network and to what the task changes them too.

0,1,2,3,9,10 - global

4,6,7 - 3g

5 - 1x

8 - LTE

My phone doesnt have a 2g option so I changed my value to 5 for 1x and it works perfectly.
[Tasker Tips & Tricks] MishaalRahman:
Yes, it should work.

My bad! I didn't realize it required the pro version of Secure Settings. Still, if you look above you can use the shell command that another XDA user provided that should work also.

I'm not sure about dual SIMs, sorry.
[Tasker Tips & Tricks] sbcrumb:
I purchased the pro no big deal. On verizon though I noticed that it doesn't work right my phone ends up in emergency calls only mode. very strange.
[Tasker Tips & Tricks] TeriusPR:
But what value should I use for AT&T 9 or 10?
[Tasker Tips & Tricks] iPAQ 6515a User:
How about the importable profile instead?
[Tasker Tips & Tricks] karakatp:
Ok thanx a lot I managed to install this profile to Tasker but another problem occurs...

Like othes here I don't have preferred_network_mode1 but only preferred_network_mode...So it will work or not?

Is anything else that we can do in order to make it works? :confused::confused::confused::confused:
[Tasker Tips & Tricks] frrancuz.:
Sorry for the mistakes.

I do not know English well.

I use Google translator.

2 ways:

1. Xposed + gravitybox or intelli3g

Send intent

For gravity:

Action: gravitybox.intent.action.CHANGE_NETWORK_TYPE

Extra: networkType:X [X most time 1,9,11]

Target: broadcast

For intelli3g:

Action: action.intelli3g.CHANGE_NETWORK_TYPE

Extra: extra.intelli3g.NETWORK_TYPE:X

Target: broadcast

read post 8 to check X - I put there manual.

2. Instal plugin:

http://xdaforums.com/android/apps-games/widget-toggle-network-type-5-0-xda-t2945406

Then set as plugin in Tasker
[Tasker Tips & Tricks] karakatp:
Thanx for the reply, but I wanted to explain how you did the following steps....

Thanx for the reply!!!
[Tasker Tips & Tricks] frrancuz.:
Instal TitaniumBackup

Manual 2g - go to settings in your phone, set 2g. :D

Import: http://fii.cz/hzjnfquk

all system settings should be in /sdcard/name.txt
[Tasker Tips & Tricks] trawel:
Any idea how to create something like smart radio using tasker?

The idea is that when you connect to wifi - 2g is on

when mobile data is off - 2g is on

when mobile data is on and wifi is not connected - lte is on

Basically I don't know how to detect if mobile data is enabled/disabled.

BTW, I'm on Android 6.0
[Tasker Tips & Tricks] frrancuz.:
task to check mobile data.

run shell:

Command: settings get global mobile_data

Store output in: %data

0 - off

1 - on
[Tasker Tips & Tricks] eeeemc:
Hello,

For Exit task....

Plugin --> Secure Settings. Expand the "Actions" dropdown and pick "Device Setting." For the Setting Table, pick "global." For the Setting Name, find "preferred_network_mode1" (make sure it's exactly this one, there are similar ones that don't work). Change the Setting Value to 9 if on T-Mobile or 10 if you're on Sprint/Verizon.

If I am in Asia area with GSM phone, Value should be 9 ? or 10 ?

Or others ?

Thank you very much.
[Tasker Tips & Tricks] karakatp:
OK BUT please could you be more detailed?

Tasker can't recognize this file in order to import it....:confused:
[Tasker Tips & Tricks] frrancuz.:
You can not import task?

Extract from zip.

Copy to /Tasker/task

Open Tasker.

Hold "task", then chose import.

or, please explain me what is wrong. Simple as you can, like to small child..
[Tasker Tips & Tricks] karakatp:
LOL When I choose import, then I choose the folder that I have put yours file but the folder seems empty!!! :confused:
[Tasker Tips & Tricks] frrancuz.:
Tasker version?

I have 4.8u1
[Tasker Tips & Tricks] ratelutz:
when i run the task tasker give this error and task did not run successfull

17.40.40/E Run Shell: ->

17.40.40/E Run Shell: ->

17.40.40/E Run Shell: ->

17.40.40/Shell runBackground setenforce permissive;

svc data disable;

setenforce enforcing; root: false timeout: -1

17.40.40/Shell start process-thread ID 290

17.40.40/E add wait type Shell1 time 2147483647

17.40.40/E add wait type Shell1 done

any idea what i'm doing wrong?
[Tasker Tips & Tricks] frrancuz.:
ROOT?
[Tasker Tips & Tricks] ratelutz:
thanks i feel so stuppid:eek:

now the task runns without an erro but the network does not change

it seems securesettings does not work right with Honor devices
[Tasker Tips & Tricks] frrancuz.:
Try this:

run shell -> command: settings put global mobile_data 0

run shell -> command: settings put global mobile_data 1

0 - off

1 - on
[Tasker Tips & Tricks] ratelutz:
nope

network stayes on 4G

or did you mean instead the secure settings part?
[Tasker Tips & Tricks] frrancuz.:
But, you wrote before..

svc data disable;/svc data enable;

-> turn on/off mobile data, not switch between 2g - LTE.

For change 2g - LTE, need command:

settings set global preferred_network_mode

Or

settings set global preferred_network_mode1 [if you have only this: mode1, command wont work]

Why you do not use plugin toggle network, if shell and command is too difficult or wont work?
[Tasker Tips & Tricks] ratelutz:
right

above message is seen if i run the task in tasker interface.

with ticking 'use root ' the task runns without error message, but nothing is switched
[Tasker Tips & Tricks] frrancuz.:
even if "settings set global preferred_network_mode " won't working, the " svc data disable;/svc data enable;" should. "svc data disable;/svc data enable; " is universal android command.
[Tasker Tips & Tricks] ratelutz:
I think the problem is the securesettings plugin. At another task i tried to switch inputmethod an it did not work also. Maybe securesettings does not work correct on honor devices

Gesendet von meinem H60-L04 mit Tapatalk
[Tasker Tips & Tricks] trawel:
And how to have that in profiles, to check it (because I suppose I have to create a profile that will run that task and do what is neccessary)
[Tasker Tips & Tricks] eeeemc:
Hi ,

Re:

Try this:

run shell -> command: settings put global mobile_data 0

run shell -> command: settings put global mobile_data 1

0 - off

1 - on

a. Does this mean I can make above as a new profile ?

b. Entry task is :

run shell -> command: settings put global mobile_data 0

c. Exit tast is :

run shell -> command: settings put global mobile_data 1

so that this profile does not require to use security setting plug-in to avoid the cumbersome setting.

also this profile is to completely disable DATA when wifi connected & enable DATA when wifi dis-connected.

Thank you very much.

Edmond
[Tasker Tips & Tricks] ratelutz:
did some more testings:

switching the mobile data on/off works. but switching the preferred_network_mode does not. neighter with securesettings plugin, nor with 'run shell -> command: settings put global preferred_network_mode (1/9)'

i also tried sqlite plugin for tasker to set the value
[Tasker Tips & Tricks] eeeemc:
I think my thought is completely no use.......... this tasker task intend to make us go to Network 2G to save battery.

The way my previous suggestion disabling DATA , which I think it already automatically done by when Android phone connected to WIFI., Data is disabled. There is not need to make a profile I previously suggested...............

This is what I understand.

Thank you very much.

edmond.
[Tasker Tips & Tricks] ratelutz:
yes think so too.

only thing we need to get done is to switch the network mode to save some juice
[Tasker Tips & Tricks] trawel:
I also cannot switch from LTE to 2G with secure settings - just nothing happens.
[Tasker Tips & Tricks] eeeemc:
Would like to know which number you set on :

Entry task

Exit task

Original of this tutor from page 1 saying Entry task set as 1 when exit task set as 9.

Of course I am having problem all the time with this Profile it never works.

Either it change my phone to 2G and never switch back to 2G/3G ( my default Andoird setting )

Or it just no longer do anything ( not even switch to 2G )

I am having a GSM phone , in Asia country.

Thank you very much.
[Tasker Tips & Tricks] Lossyx:
How do I find out my preferred_network_mode1 number for 4G?

I live in Sweden and and tried default (22), 1 and 2 but it only enables 3G
[Tasker Tips & Tricks] ratelutz:
switch to 4G

install an sqlite editor or viewer and open

/data/data/com.android.providers.settings/databases/settings.db and check the value of preferred_network_mode
[Tasker Tips & Tricks] Brutal_Master:
Here's a stupid question:

How do you enter 3 separate commands into the command line in tasker's "run shell" ? Do I just put ';' after each command? Is that enough?

setenforce permissive; svc data disable; setenforce enforcing
[Tasker Tips & Tricks] drix95:
Hi guys, I have the exact same issue with my honor 7, I can't find a way to switch the preferred network.

The task seems to work fine, but the network doesn't switch.... is it because of the phone hardware? I don't know...

sent from Honor 7 plk-L01
[Tasker Tips & Tricks] Javi22:
Thanks a lot for this tutorial. So useful

However in my nexus 5x I can't find the preferred network mode1. I only have a preferred network mode without the '1'
[Tasker Tips & Tricks] snej81:
This is a really good tutorial. I am for the moment using Autoinput plugin for Tasker to toggle Mobile data OFF when not connected to Wifi. Problem is I cant receive any MMS when Mobile data is OFF, as well TOGGLE Mobile data is the only option, you cannot turn ON or OFF. Autoinput is a really awesome plugin though, on of the best i tried (escpacially if your not rooted, as me).

I will though try this method as soon I am rooted!
[Tasker Tips & Tricks] MishaalRahman:
Play around and find the specific variable that works for your device. It differs for many set ups but it should be there somewhere.
[Tasker Tips & Tricks] snej81:
Now I have played with this for a while and I face the same problem as many other users, I only have preferred_network_mode (without the '1').

I choose it since there not are any alternatives, but it doesn´t matter which ``Setting value´´ I choose, all values gives the same result = 4G is turned on. So this works only as a 4G toggler for me as well...

---------- Post added at 22:44 ---------- Previous post was at 22:31 ----------

I also tried this below to get my preffered network, and by installing SQlite for Tasker but I cant understand how to read out the values... Could someone please make a screenshot of how it should be done? :cyclops::eek:
[Tasker Tips & Tricks] frrancuz.:
if you do not have "1" this metod do not work.

this is solution for you:

https://play.google.com/store/apps/details?id=com.cygery.togglenetworktype
[Tasker Tips & Tricks] snej81:
Thanks a alot, this app actually works really good as a plugin through Tasker as well. Cheers :good:
[Tasker Tips & Tricks] stefano91av:
Hello and thanks for the written guide :)

On my elephone P8000 works perfectly as wifi and 4g switch .

Unfortunately it remains in 4g , even if the data connection is not used .

In " preferred_network_mode1 " I entered " 0 " . What do you advise?
[Tasker Tips & Tricks] frrancuz.:
Check others numbers. :)
[Tasker Tips & Tricks] stefano91av:
How? :)

Inviato dal mio Elephone P8000 utilizzando Tapatalk
[Tasker Tips & Tricks] kmry:
what if i only want this: if wifi is on then mobile data of, and vice versa; gravity box made and excellent work with smart radio, but this is the las piece of that amazing work i think.
[Tasker Tips & Tricks] neorejalist:
After a long search for doing this in nougat i found a thread on stackoverflow (question 37848059, but i'm not allowed to link because i made my account for this post).

the trick is stopping and starting the ril-daemon (whatever it is :P)

so the shell command for enabling only 2g is:

setenforce permissive;

settings put global preferred_network_mode 1;

ettings put global preferred_network_mode1 1;

stop ril-daemon;

start ril-daemon;

setenforce enforcing;

Great work everybody on the forums by the way, i've solved a lot of my problems here.
[Tasker Tips & Tricks] 22vlaja:
Secure setting is paid app if you want to enter Device setting, is there any other free app, that support same thing? thanks
[Tasker Tips & Tricks] alienyd:
depending on what you want to do, maybe you can achieve it through command lines
[Tasker Tips & Tricks] 22vlaja:
"Maybe" is not the same as you "can". However, OP should put in tutorial that you need to paid if you want it to work...
[Tasker Tips & Tricks] zimmbadroid:
You can try Automate app with last flow from ss below

Note that sometimes it won't switch, at least in my case. Workaround is to Stop-Start the flow to make it switching again.
[Tasker Tips & Tricks] jukyO:
[MENTION=7050182]MishaalRahman[/MENTION]

--> I have only "system" here in drop down menu. Anything to do about it or not possible to have "global"?

[EDIT]

This one resolved it:

https://dammit.nl/20160406-how-to-f...oid-devices-with-supersu-systemless-root.html

---------- Post added at 09:57 AM ---------- Previous post was at 09:04 AM ----------

[MENTION=7050182]MishaalRahman[/MENTION]

If we do it like this in tasker, then Secure settings part is not needed, as we have settings put global preferred_network_mode 1;

settings put global preferred_network_mode1 1; already in. Am I right?
[Tasker Tips & Tricks] MishaalRahman:
Secure Settings needs WRITE_SECURE_SETTINGS permission which you have to grant manually via ADB.
[Tasker Tips & Tricks] midhunmanohar:
Dayyum, you made my day. I am trying to find a solution to do a one click task to switch default data sim on dual SIM phone since a week. I was going through every single thread. I had the settings change command working but the settings never reflected in the system. That ril-daemon restarting worked and the commands are executing perfectly. You are the man! Thanks a lot!!! There are many many many threads which needs this answer. I will do my best to link this post to them.
[Tasker Tips & Tricks] eried1:
When I searched for this on Nougat people wrote that I should use preferred_network_mode, preferred_network_mode0 1 and preferred_network_mode1 1? What differences does it make if you exclude preferred_network_mode0 1?
[Tasker Tips & Tricks] Plomiwn:
Hey there,

I know it's been a while since this subject was active but anyone know how to make:

settings put global preferred_network_mode 1;
settings put global preferred_network_mode1 1;

to stick?

Because every time i switch those variables to my preference, in a second and/or after restart of ril-daemon it's back to values that was set by system before.
[Tasker Tips & Tricks] mattie_49:
This thread is pretty old. I've tried using recently with no luck. However I did find this xposed module and it works nicely. Requires both this one and another named the same.

https://play.google.com/store/apps/details?id=com.xorware.network.s2g3g.settings
[Tasker Tips & Tricks] locolyric:
can't just make a script for tasker and we do is just import it?
[Tasker Tips & Tricks] eeeemc88:
setenforce permissive;

settings put global preferred_network_mode 1;

ettings put global preferred_network_mode1 1;

stop ril-daemon;

start ril-daemon;

setenforce enforcing;

Perfectly works !! ( and thanks to all in the thread )

What would be the setting though force it from ( above 2G ) to " 3G ONLY ". * ( also if 4G ONLY )

*** in Europe / Asia's GSM network.

Thank you very much.

edmond.

---------- Post added at 10:41 AM ---------- Previous post was at 09:57 AM ----------

I myself just tested & found a solution ..............................

( The above 2G task is when screen off )

Below is when screen on :

wait 5 seconds

Use Plug in: Secure Setting:

Setting table: Global

Setting Name: preferred_netword_mode ( *** do not choose preferred_netword_mode1 )

Setting Value: 0,0

( do not forget press save icon at right top )

Failure:

It appears above set to 2G/3G only ( Asia/Europe GSM situation ) instead of 3G only

( as I prefer it at purely 3G only )

Hope someone can suggest a run shell command instead of using my above method and set it at purely "3G only"

Thanks

Edmond.
[Tasker Tips & Tricks] locolyric:
works as description ! thanks for your tutorial!
[Tasker Tips & Tricks] eeeemc88:
Glad it works for you I guess you are on GSM ( Asia ) mobile ...........

I'm still not satisfy to the setting return back to :

Purely 3G

or

4G Lte

I tested a lot but couldn't find any correct "digit" to use.

i.e.

settings put global preferred_network_mode 1; ( set what for purely 3G or 4G Lte ? )

settings put global preferred_network_mode1 1; ( set what for purely 3G or 4G Lte ? )

Thank you !!!
[Tasker Tips & Tricks] xt7xda:
Hi,

I'm using Moto lux XT1562, lineage os 14.1.

in tasker

settings put global preferred_network_mode 1;

settings put global preferred_network_mode1 1;

stop ril-daemon;

start ril-daemon;

it's not working.

After setting network to 2g manually, I'm getting following:

settings list global | grep pref

preferred_network_mode1=1

preferred_network_mode2=9

preferred_network_mode=0

user_preferred_data_sub=1

after switching to 4G

preferred_network_mode1=9

preferred_network_mode2=9

preferred_network_mode=0

user_preferred_data_sub=1

Is there any way to make it work without secure settings?
[Tasker Tips & Tricks] eeeemc88:
Hello ,

Full correct run shell command is :

setenforce permissive;

settings put global preferred_network_mode 1;

ettings put global preferred_network_mode1 1;

stop ril-daemon;

start ril-daemon;

setenforce enforcing

Secondly , there not need using Securty Setting apps as I only applied above RUN SHELL command and my phone can turn itself to 2G ( **** in Asia GSM environment )

I'm still looking for a run shell command for GSM to PURELY 3G ( or PURELY Lte )

Thank you !

Edmond.
[Tasker Tips & Tricks] xt7xda:
Thanks for the reply...

But i tried that also... Didn't work.

I'm in India...

To know code for 3G, you should manually switch to 3G, then run that "grep pref" command in termux/terminal app in phone.
[Tasker Tips & Tricks] eeeemc88:
sorry ..... I typo missing "s" ( ettings put global preferred_network_mode1 1; )

1. Should use RUN SHELL as below

2. Each line need separate by "ENTER" ( new line )

setenforce permissive;

settings put global preferred_network_mode 1;

settings put global preferred_network_mode1 1;

stop ril-daemon;

start ril-daemon;

setenforce enforcing

I believe India is same networking environment same as mine ( Hong Kong )

Honestly , when I'am in Tasker and hit the task above , 2G immediately appear.

I'm going to post screen capture later when I am free.

Thanks

edmond

Thanks

edmond

---------- Post added at 01:08 PM ---------- Previous post was at 12:45 PM ----------

How to insert pics in here from my compurter local drive...?
[Tasker Tips & Tricks] xt7xda:
[MENTION=9158046]eeeemc88[/MENTION]

I tried now. It's not working. It's disabling the network and enabling but stays on 4G.
[Tasker Tips & Tricks] eeeemc88:
It;s true it cut the line ( stoppoing network ) . I just play around with below & you see if this apply on your phone function well .........

When Screen Off ( Entry task )

setenforce permissive;

settings put global preferred_network_mode 1;

settings put global preferred_network_mode1 1;

setenforce enforcing

( Exit task )

setenforce permissive;

settings put global preferred_network_mode 9;

settings put global preferred_network_mode9 9;

setenforce enforcing

- You see it skipped again the two command lines

stop ril-daemon;

start ril-daemon;

- Exit task above is 2G/3G/4G

- Try to add a ** wait 8 seconds ** as the first line in exit task .

So that once the screen on you can quickly switch to CELLULAR SETTING PAGE on your phone to see if it is on 2G ansd you have 8 seconds to watching if it successfully switch from 2G to 2G/3G/4G

Hope works for you

Thanks

edmond
[Tasker Tips & Tricks] xt7xda:
I'll try and update here...

Thanks
[Tasker Tips & Tricks] Anonymalious:
[MENTION=4502017]frrancuz.[/MENTION] Thank you so much, it worked! I was getting desperate because i couldnt get wifi calling to work on my phone where the reception is bad at my condo!
[Tasker Tips & Tricks] Sigit104:
[MENTION=4502017]frrancuz.[/MENTION] Thank you so much, it worked! I was getting desperate because i couldnt get wifi calling to work on my phone where the reception is bad at my condo!
[Tasker Tips & Tricks] zrzhu:
i put in the exact same command. How can I check if it works? I went to "About phone" ---> "Mobile network type", it still shows "LTE".
[Tasker Tips & Tricks] eeeemc88:
I check from : Setting > Sim > Cellar Network > Preferred Network Mode.

I guess definitely not starting from About Phone

Thanks
[Tasker Tips & Tricks] zrzhu:
I have LG v30. I have this in Setting ---> Network--->Mobile Networks ---->Network mode---->Preferred network mode: Automatic LTE/3G/2G.
[Tasker Tips & Tricks] anzhaki:
Unfortunately those commands are not working anymore. I'm currently on stock android Pie (Mi A2 lite).

In settings menu, network switching works from 2g to 4g or viceverse, but it is not being applied.

Are there new commands?
[Tasker Tips & Tricks] ktmom:
You may need multiple preferred network commands or to toggle airplane mode to make it take.

These tasks would be an example.

Data to 2G

Data to 4G

"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
[Tasker Tips & Tricks] anzhaki:
Thank you but still the same problem, in menu settings it changes but not getting applied effectively.
[Tasker Tips & Tricks] ktmom:
Does it switch correctly if you toggle it manually in settings?

"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
[Tasker Tips & Tricks] anzhaki:
Yes it works correctly by toggling it manually.
[Tasker Tips & Tricks] ktmom:
Then it's the ROM. Probably looking for a broadcast intent.

"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
[Tasker Tips & Tricks] anzhaki:
Is there any way to at least open the dialog menu from settings to choose the preferred network? In tasker options I only found the way to open network settings but then I have to manually navigate to the option to switch network.

Thanks
[Tasker Tips & Tricks] ktmom:
The best I can suggest is the Mobile Data Settings action with a AutoInput action to expand the advanced menu. You could continue with AutoInput actions to automate the entire process.

"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini