认为,
我已经从模拟器向我的手机号码发送了一条短信,但我的手机没有收到任何消息。是否可以查看从“模拟器”在我的手机上发送的短信。如果可以,如何?
到目前为止,我已经做到了这一点,并将其敬酒为“发送短信”。请在下面找到我的来源
public class Send_sms extends Activity {
private static final String TAG = "Send_sms";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main12);
Button sndbtn =(Button)findViewById(R.id.but_send_ok);
sndbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
EditText addrTxt = (EditText)Send_sms.this.findViewById(R.id.editText_number);
EditText msgTxt = (EditText)Send_sms.this.findViewById(R.id.editText_write_msg);
try
{
sendSmsMessage(addrTxt.getText().toString(),msgTxt.getText().toString());
Toast.makeText(Send_sms.this,"Sms sent",Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
Toast.makeText(Send_sms.this,"Failed to send sms",Toast.LENGTH_LONG).show();
}
}});
}
@Override
protected void onDestroy() {
super.onDestroy();
}
private void sendSmsMessage(String address,String message)throws Exception
{
SmsManager smsMgr = SmsManager.getDefault();
smsMgr.sendTextMessage(address,null,message,null,null);
}
}