Tasker Dual sim data switcher Fi

Cdaddy002

New member
Jun 17, 2019
2
0
0
I'm not a tasker pro, so there are probably at least 20 ways this can be better. I wanted a way to quickly change which sim is used for data. I created a task in tasker which is called from a quick tile to do the switch.

The tasker stuff is after the green text (if you just want to scroll).

Fi has 3 cellular providers, TMobile, Sprint and US cellular.

There are 9 options for providers in Android global settings:
mobile_data1, mobile_data2, ... mobile_data9 (might also be a mobile_data (with out a numerical suffix), can't remember lol).

Your sim will use one for each provider. So I would have 3 providers for Fi and 1 for at&t. You will need to figure out which of the 9 you are using. Easy way would be to use autotools and read the values of these settings then just "flash" the value on the screen. If you have a computer and can use adb, that works too. You can use fiswitch to change Fi providers, then use the flash method to figure out the provider number.

In my case it was mobile_data4 (TMobile), mobile_data5 (Sprint), mobile_data6 (US cellular), and mobile_data8 (at&t).

When switching SIMs the active sim has all of its providers disabled. The providers for the new sim are then enabled. After that you update a setting (multi_sim_data_call) to tell Android which provider to use for data. You will want to disable data, update this setting, then enable data. You will also need to stop and start ril-daemon using a shell command (toggling air plane mode works too, but I think restarting ril is faster).

Note: because I use Fi soon for phone, I use the setting to figure out which provider to use when switching to fi.

I used autotools to set the globals because that's where I started (it's working great so I don't want to mess with it). There are probably several ways to do it.


Here's what I did in tasker:
SIM Swap Example (18)
<get current data provider>
A1: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: multi_sim_data_call
Input Type: String
Read Setting: true Timeout (Seconds):60 ]
<get current phone provider>
A2: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: multi_sim_voice_call
Input Type: String
Read Setting: true Timeout (Seconds):60 ]
A3: [X] Flash [ Text:Data: %multi_sim_data_call Voice: %multi_sim_voice_call Long:eek:ff ]
<if att>
A4: If [ %multi_sim_data_call ~ 8 ]
<disable att>
A5: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data8
Input Type: Int
Value: 0 Timeout (Seconds):60 ]
<enable TMobile>
A6: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data4
Input Type: Int
Value: 1 Timeout (Seconds):60 ]
<enable sprint>
A7: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data5
Input Type: Int
Value: 1 Timeout (Seconds):60 ]
<enable us cellular>
A8: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data6
Input Type: Int
Value: 1 Timeout (Seconds):60 ]
<set data to fi phone provider>
A9: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: multi_sim_data_call
Input Type: String
Value: %multi_sim_voice_call Timeout (Seconds):60 ]
A10: Mobile Data [ Set:eek:ff ]
<stop ril-daemon>
A11: Run Shell [ Command:stop ril-daemon Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
<else fi selected>
A12: Else
<disable Fi (TMobile)>
A13: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data4
Input Type: Int
Value: 0 Timeout (Seconds):60 ]
<disable Sprint>
A14: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data5
Input Type: Int
Value: 0 Timeout (Seconds):60 ]
<disable us cellular>
A15: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data6
Input Type: Int
Value: 0 Timeout (Seconds):60 ]
<enable at&t>
A16: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: mobile_data8
Input Type: Int
Value: 1 Timeout (Seconds):60 ]
<set data to at&t>
A17: AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: multi_sim_data_call
Input Type: String
Value: 8 Timeout (Seconds):60 ]
A18: Mobile Data [ Set:eek:ff ]
<stop ril-daemon>
A19: Run Shell [ Command:stop ril-daemon Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A20: End If
A21: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
<start ril-daemon>
A22: Run Shell [ Command:start ril-daemon Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A23: Mobile Data [ Set:eek:n ]
A24: [X] AutoTools Secure Settings [ Configuration:Setting Type: Global
Name: multi_sim_data_call
Input Type: String
Read Setting: true Timeout (Seconds):60 ]
A25: [X] Flash [ Text:Data: %multi_sim_data_call Voice: %multi_sim_voice_call Long:eek:ff ]