9

In one of my applications,I am passing latitude and logitude from my app to whatsapp and want to share that location.I achieved it using this piece of code.

public void sendMessage() {
    String whatsAppMessage = "http://maps.google.com/maps?saddr=" + latitude + "," + longitude;
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, whatsAppMessage);
    sendIntent.setType("text/plain");
    sendIntent.setPackage("com.whatsapp");
    startActivity(sendIntent);
}

Everything is fine since it is giving me location card from google maps and I am able to share the same.But I just wanna know,is there anyway so that I can share location like how whatsapp do it by default.I mean the card which Whatsapp uses.Please Check the screen shot for clear understanding.enter image description here. Any help is appreciated.Thanks in advance.

SudheeR Bolla
  • 171
  • 2
  • 12

0 Answers0