Java 如何在设置默认 sim 的双 SIM 卡中在 android 中发送短信?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24007885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 09:40:29  来源:igfitidea点击:

How can send sms in android in dual SIM with set default sim?

javaandroidsmsmessageandroid-broadcast

提问by Nitin Karale

How can send sms in android with dual sim for broadcast not intent?? How can detect dual sim in android? User wants to select sim for send sms broadcast. In android set the default sim for sending msg in dual sim in android. User have to select particular sim for sending sms.

如何在android中使用双卡发送短信以进行广播而不是有意的??如何在android中检测双卡?用户想要选择 sim 发送短信广播。在 android 中设置默认 sim 用于在 android 中的双卡中发送 msg。用户必须选择特定的 sim 来发送短信。

回答by eGregory

If the output of the shell command 'service list' contains 'telephony.registry2', then the phone has a second SIM card. If contains 'telephony.registry3', then phone has a third SIM card and so on.

如果 shell 命令“ service list”的输出包含“ telephony.registry2”,则手机有第二张 SIM 卡。如果包含“ telephony.registry3”,则手机有第三张 SIM 卡,依此类推。

You can use this shell commandto send from the first SIM card:

您可以使用此 shell 命令从第一张 SIM 卡发送:

service call isms 5 s16 "PhoneNumber" i32 0 i32 0 s16 "BodyText"

and from the second SIM card

并从第二张 SIM 卡

service call isms2 5 s16 "PhoneNumber" i32 0 i32 0 s16 "BodyText"

Require android.permission.SEND_SMS

要求 android.permission.SEND_SMS