问题
I am developing an app that requires sending messages automatically for hardware button press. It is working nice in single SIM phone, but not in dual SIM. So is there any way to set the default SIM while sending message or making a voice call programmatically when using dual SIM phones?
回答1:
ContentValues val = new ContentValues();
val.put("value", "here goes the preferred SIM ID");
getContentResolver().update(Uri.parse("content://settings/system"), val, "name='sms_sim_setting'", null);
This portion of code is working nice for me.This can be extended for other SIM selection scenarios. Setting cache contains entry with name S, voice_call_sim_setting, gprs_connection_sim_setting, video_call_sim_setting etc.But it requires users permission to write settings. --from Janaka Bandara
来源:https://stackoverflow.com/questions/30379442/sending-message-automatically-in-dual-sim