此代碼爲我的中國A918 DualSim Android手機:
Intent intent = new Intent();
intent.setClassName("com.android.phone", "com.mediatek.settings.MultipleSimActivity");
PackageManager packageManager = getPackageManager();
// check if intent is available on device:
List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0) {
// set Intent to start after SIM card selection:
intent.putExtra("TARGET_CLASS", "com.android.phone.NetworkSetting");
intent.putExtra("ITEM_TYPE", "PreferenceScreen");
} else {
// run default android network settings intent
intent.setClassName("com.android.phone", "com.android.phone.NetworkSetting");
}
startActivity(intent);
在Android中DualSim手機需要運行不同的意向進入NetworkSettings已,因爲當插入兩張SIM卡,你應該有選擇的能力第一張或第二張牌。我的情況是com.mediatek.settings.MultipleSimActivity
。如果它不工作,檢查ADB日誌哪些意圖通過Android系統進入「可用網絡」時啓動設置
您可以嘗試使用'MultiSim'庫: http://stackoverflow.com/a/41544422/ 1665964 – 2017-01-09 11:34:56