Jigar
Jigar

Reputation: 791

pass URL in SMS body in android

I am putting some predefined text in sms body and proceeding for SMS with below code

Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri
                            .parse("smsto:" + unsuccessContacts));
smsIntent.putExtra("sms_body","Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!");
startActivityForResult(smsIntent, SEND_SMS);

so when it opens my SMS window it shows predefined text as

"Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!"

but what i want is

"Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!"

so basically i want a hyperlink at "http://example.com/invite.html"

Can any one help me out with this?

Upvotes: 0

Views: 2560

Answers (1)

Fahim
Fahim

Reputation: 12358

Use in this manner

    Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri
                            .parse("smsto:" + unsuccessContacts));
smsIntent.putExtra("sms_body","Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!"));
startActivityForResult(smsIntent, SEND_SMS);

or

 SmsManager smsManager = SmsManager.getDefault();
    String text = "Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!";
smsManager.sendTextMessage(number, null, text, null, null);

Automatically android detect links and hyperlink it by default.

Upvotes: 1

Related Questions