2

I'm developing an app where I have to share a location from my activity to social media, until now I can share the location as link, but i want to share the location and display it as Whatsapp shows the location , i mean with the map image.

Can any one guide me to how to do this. I'v tried the bellow

String geoUri = "http://maps.google.com/maps?q=loc:" + driveToLocation.getPosition().latitude + "," +
                    driveToLocation.getPosition().longitude ;

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Location Name");
shareIntent.putExtra(Intent.EXTRA_TEXT, geoUri);
startActivity(Intent.createChooser(shareIntent, "Share via"));

Thanks in advance .

kartikmaji
  • 946
  • 7
  • 22
Thair Jaber
  • 117
  • 1
  • 8
  • 1
    http://stackoverflow.com/questions/5842144/sharing-map-based-location?answertab=active#tab-top – M.ArslanKhan Jan 07 '16 at 20:19
  • 2
    this question has been asked and answered here: http://stackoverflow.com/questions/12668551/share-location-with-share-intent-activity?rq=1 – hcarrasko Jan 07 '16 at 20:41
  • 1
    Possible duplicate of [share location with share intent Activity](http://stackoverflow.com/questions/12668551/share-location-with-share-intent-activity) – hcarrasko Jan 07 '16 at 20:43

1 Answers1

0

For this you can use Google static map api. You may use an ImageView to show static maps image through url.

http://maps.google.com/maps/api/staticmap?center=37.400470,-122.072981&zoom=13&size=500x300&sensor=TRUE_OR_FALSE

To show image you just need lat and long.Just try it. Share the above on Social Media.
OR

You may refer this link and convert layout into image and share it on social media.

Garg
  • 2,731
  • 2
  • 36
  • 47
Mahesh Giri
  • 1,810
  • 19
  • 27