【问题标题】:Send SMS with wifi on Android在 Android 上使用 wifi 发送短信
【发布时间】:2012-08-25 06:45:45
【问题描述】:

我如何在android上通过wifi、socket或...发送短信?我想将消息发送到一个模拟器到第二个模拟器。我该怎么做?

【问题讨论】:

  • 将短信从一个模拟器发送到另一个,将发送号码设置为显示在模拟器顶部的其他模拟器号码,如:5556,5558 等

标签: android sockets android-emulator android-wifi


【解决方案1】:

这用于从一个模拟器向另一个模拟器发送消息。

btnSendSMS.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
sendSMS("5556", "Hi You got a message!");
}
});

//---sends an SMS message to another device---

private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
} 

这用于从一个模拟器向多个模拟器发送消息。

btnSendSMS.setOnClickListener(new View.OnClickListener()
   {
     public void onClick(View v)
        {
         Intent i = new
              Intent(android.content.Intent.ACTION_VIEW);
              i.putExtra("address", "5556; 5558; 5560");
              i.putExtra("sms_body", "Hello my friends!");
              i.setType("vnd.android-dir/mms-sms");
              startActivity(i);
         }
    });

【讨论】:

  • 但我想用 wifi 发送。关于wifi我必须知道的。可能是wifi ip?
  • 无线上网短信?没门。您可以通过实现 TCP 套接字在 wifi 中发送消息。甚至是这种意义上的文件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-04
  • 2018-06-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多