从 android & eclipse 发送短信
sending SMS from android & eclipse
我正在尝试从一个模拟器向另一个模拟器发送短信,
我有 3 个字符串,然后我将这 3 个字符串添加到一个字符串中,然后尝试发送 SMS,但它只是发送“null”。
private String fm = mSelectedItemExam+" "+mSelectedItemBoard+" "+mSelectedItemYear;
public void Submit(View view) {
// sendSMS function
sendSMS("5556", fm);
}
private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
检查 Screenshot 以查看我在另一个模拟器上收到的内容
Log.i("Send SMS", "");
String phoneNo = "1212";
String message = "msms";
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, message, null, null);
试试这个,
public void Submit(View view) {
private String fm = mSelectedItemExam+" "+mSelectedItemBoard+" "+mSelectedItemYear;
// sendSMS function
sendSMS("5556", fm);
}
private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
试试这个:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "default content");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
我正在尝试从一个模拟器向另一个模拟器发送短信, 我有 3 个字符串,然后我将这 3 个字符串添加到一个字符串中,然后尝试发送 SMS,但它只是发送“null”。
private String fm = mSelectedItemExam+" "+mSelectedItemBoard+" "+mSelectedItemYear;
public void Submit(View view) {
// sendSMS function
sendSMS("5556", fm);
}
private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
检查 Screenshot 以查看我在另一个模拟器上收到的内容
Log.i("Send SMS", "");
String phoneNo = "1212";
String message = "msms";
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, message, null, null);
试试这个,
public void Submit(View view) {
private String fm = mSelectedItemExam+" "+mSelectedItemBoard+" "+mSelectedItemYear;
// sendSMS function
sendSMS("5556", fm);
}
private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
试试这个:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "default content");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);