gpt4 book ai didi

android - 是否可以从 Android 应用程序向非 Android 移动设备发送短信?

转载 作者:太空狗 更新时间:2023-10-29 15:07:14 25 4
gpt4 key购买 nike

我正在为学校教师开发一个应用程序。我希望它向所有 parent 发送短信。所以我也想将 SMS 发送到非 Android 设备(即 Android 应用程序到可能也没有互联网的任何其他设备)。

如果可能,请给我解决方案。这是我目前所拥有的:

public class SendSMSActivity extends Activity {
Button buttonSend;
EditText textPhoneNo;
EditText textSMS;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
buttonSend = (Button) findViewById(R.id.buttonSend);
textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
textSMS = (EditText) findViewById(R.id.editTextSMS);
buttonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//
// String phoneNo = textPhoneNo.getText().toString();
// String sms = textSMS.getText().toString();
//
// try {
// SmsManager smsManager = SmsManager.getDefault();
// smsManager.sendTextMessage(phoneNo, null, sms, null, null);
// Toast.makeText(getApplicationContext(), "SMS Sent!",
// Toast.LENGTH_LONG).show();
// } catch (Exception e) {
// Toast.makeText(getApplicationContext(),
// "SMS faild, please try again later!",
// Toast.LENGTH_LONG).show();
// e.printStackTrace();
// }
String number = "9940571282";
String message = "hi there";
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:" + number ) );
intent.putExtra( "sms_body", message );
startActivity( intent );
}
});
}
}

最佳答案

短信与任何特定平台无关。

So, "YES", you can send SMS to non-android phones.

发送短信也不需要手机连接到互联网。

So, "YES", you can send SMS to a device which may not have internet.

至于解决方案,请先做一些研究,然后尝试一些样本和示例。

关于android - 是否可以从 Android 应用程序向非 Android 移动设备发送短信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20756113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com