How to add a hyperlink in an SMS message on an Android phone?

I want to send an SMS message with the message body, for example: "Where am I?" when I click “Where am I?”, it will take me to the Google map site with my location. My question is, how do I add this hyperlink to "where am I?" Message text? Is there any example that I can study?

+7
source share
2 answers

SMS messages are text and they only allow 160 characters. What you offer will include: "Where am I?" in 160 characters, but also somehow include a very long web address.

The first thing you might want to do is use some URL shortening service. I don’t have what I can personally recommend, but there are Django applications, among other things, and online services that you can connect to using the API (for example, bit.ly). This will give you a unique link to easily fit into the available SMS characters.

Most smartphones will analyze the link and make it “accessible”, even if it is in SMS. So, for example, you can make the text as follows:

Where am I? www.linkgoesh.ere/somehash 

The user should be able to click the link and visit the website. It is not as elegant as you suggest, but SMS is a (necessarily) limited format.

+8
source

Try this code, it should solve your problem.

 String uri = "http://maps.google.com/maps?saddr="+latitude +","+longitude; SmsManager smsManager = SmsManager.getDefault(); StringBuffer smsBody = new StringBuffer(); //long number = Long.parseLong(get_number); smsBody.append(Uri.parse(uri)); smsManager.sendTextMessage(get_number, null, smsBody.toString(), null, null); 
-2
source

All Articles