I have created an android application. Now I want to send SMS through it to a real mobile number... Can somebody please help me with it. The information provided on the internet is to send message between two emulators. But I want to send sms on a real mobile number... Please help me out with it.
Asked
Active
Viewed 1,791 times
1
-
The emulator has no mobile phone contract / number / etc, so that does not work. – zapl May 21 '12 at 16:39
3 Answers
1
The emulator its not a real phone, don't have a number or sim card so it can't send or receive sms from external devices. From cmd telnet you can use sms send phonenumber
EDIT :
private SmsMessage[] getMessagesFromIntent(Intent intent) {
SmsMessage msgs[] = null;
Bundle bundle = intent.getExtras();
try {
Object pdus[] = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int n = 0; n < pdus.length; n++) {
byte[] byteData = (byte[]) pdus[n];
msgs[n] = SmsMessage.createFromPdu(byteData);
}
}
catch (Exception e) {
Logger.getDefault().error("Fail to create an incoming SMS from pdus", e);
}
return msgs;
}

113408
- 3,364
- 6
- 27
- 54
-
so how can i enable sms facility in my application..any ideas? – thedarkpassenger May 22 '12 at 05:15
-
I don't understand your question but if you want to read sms from your application you have to use broadcastreceiver. see the edit above. – 113408 May 22 '12 at 08:08
1
I think you couldn't send SMS from Emulator to real device because it doesn't have any number. I have added the code below which will be helpful to send sms from real device.
PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, RoadMoveActivity.class), 0);
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(sms_phonenumber, null, sms_message, pi, null);
Its worked for me

vinothp
- 9,939
- 19
- 61
- 103
0
Refer this Question for how to set up an email account in your android emulator How can i configure gmail in Android emulator? and then use the following code to send a email,
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"youremail@yahoo.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "subject");
email.putExtra(Intent.EXTRA_TEXT, "message");
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));