Page 1 of 1

Dual Sim control

Posted: 15 Sep 2013 09:45
by V10
Hi.

There is simple code for control dual sim phone in MTK (mediatek) chipsets. Can you add this to Automagic?

1) Enable \ disable radio module on single sim card

java code:

Code: Select all

        Settings.System.putInt(getContentResolver(), "dual_sim_mode_setting", simN);
        Intent localIntent = new Intent("android.intent.action.DUAL_SIM_MODE");
        localIntent.putExtra("mode", simN);
        sendBroadcast(localIntent);
Where simN is sim card number, 0 - disable all sim cards radio modules, 1 - allow only first sim card radio module, 2 - allow only second sim card radio module, 3 - allow all sim cards radio module

shell script (root):
mtk_sim_radio_control.sh

Code: Select all

#!/bin/sh
settings put system dual_sim_mode_setting $1
am broadcast -a android.intent.action.DUAL_SIM_MODE --ei mode $1
run: sh mtk_sim_radio_control.sh simN


2) Select sim card for 3G or disable data radio module
java code:

Code: Select all

        Settings.System.putLong(getContentResolver(), "gprs_connection_sim_setting ", simN);
        Intent localIntent = new Intent("android.intent.action.DATA_DEFAULT_SIM");
        localIntent.putExtra("simid", simN);
        sendBroadcast(localIntent);
Where simN is sim card number, 0 - disable all sim cards data radio module, 1 - use first sim card data radio module, 2 - use second sim card data radio module

shell script (root):
mtk_sim_3g_control.sh

Code: Select all

#!/bin/sh
settings put system gprs_connection_sim_setting $1
am broadcast -a android.intent.action.DATA_DEFAULT_SIM --el simid $1
run: sh mtk_sim_3g_control.sh simN

Re: Dual Sim control

Posted: 15 Sep 2013 11:22
by Martin
Hi,

Thanks for the detailed request!
Unfortunately I don't have the time to add device specific actions to Automagic in the near future, I'm concentrating on features that are officially available on Android or on features that are very popular.
Perhaps you could create an automation plugin to control the dual SIM features: Plugin Doc. This would make the functions also available for other automation tools like Tasker, Llama and Locale.

The next version of Automagic adds a new action to modify system settings that helps a little to make such device specific settings available in Automagic without using shell scripts but you will still have to send the broadcast to announce the change in the system.

Regards,
Martin

Re: Dual Sim control

Posted: 18 Jan 2014 19:27
by joaormf
Hi,

I've made a plugin that uses the Locale/Automagic plugin interface.

It's called "MTK Control", search for it on Play Store.

Re: Dual Sim control

Posted: 09 Jul 2014 10:19
by Nerey
Hi
How to use your plugin?

Re: Dual Sim control

Posted: 28 Nov 2014 13:38
by joaormf
Nerey wrote:Hi
How to use your plugin?
Hi,

Go to Google Play store and search for "MTK Control". I have a free version that you can use to check if it's compatible with your phone.

The more advanced features are only available as premium or on the paid version.

Re: Dual Sim control

Posted: 27 Jul 2015 08:53
by Pr0grammer
i need code to deactivate single sim card phone.
please help me!