简体   繁体   English

我们可以使用 SmsManager 向其他非 android 设备发送短信吗?

[英]Can we send sms to other non android device using SmsManager?

I am working on an android application, in which we are dealing with android sms service.我正在开发一个 android 应用程序,我们正在处理 android 短信服务。 I just want to know that is it possible to send sms to other non android device using the below method.我只想知道是否可以使用以下方法向其他非 android 设备发送短信。

SmsManager sm = SmsManager.getDefault();

// HERE IS WHERE THE DESTINATION OF THE TEXT SHOULD GO

String number = "6508570720";

sm.sendTextMessage(number, null, "Test SMS Message", null, null);

OR或者

Do we have any other method to achieve this task.我们有没有其他方法来完成这个任务。

SMS is not a device specific feature. SMS 不是设备特定的功能。 It is provided and controlled by Telecom / Cellular service provider.它由电信/蜂窝服务提供商提供和控制。 So the code should send SMS to any phone from your Android device.所以代码应该从您的 Android 设备向任何手机发送短信。

You may also try the following code:您也可以尝试以下代码:

String number = "6508570720";
String message = "hi there";

Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:" + number ) ); intent.putExtra( "sms_body", message ); startActivity( intent );

Yep, This should work for sending sms to non-android devices as well.是的,这也适用于向非安卓设备发送短信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM