0

I am trying to develop an android app and I want to upload an image to my instagram app and write my own message in caption part or add a location. I did some research about it and find I could not use instagtam's API to uploud an image directly. So I am trying to pass my picture to the instagram app and add my caption and location. How can I pass caption message and my location to instagram app?!

Would you please help me. Thanks in advance

R2D2
  • 61
  • 7

1 Answers1

1
    String type = "image/*";
String filename = "/myPhoto.jpg";
String mediaPath = Environment.getExternalStorageDirectory() + filename;

createInstagramIntent(type, mediaPath);

private void createInstagramIntent(String type, String mediaPath){

    // Create the new Intent using the 'Send' action.
    Intent share = new Intent(Intent.ACTION_SEND);

    // Set the MIME type
    share.setType(type);

    // Create the URI from the media
    File media = new File(mediaPath);
    Uri uri = Uri.fromFile(media);

    // Add the URI to the Intent.
    share.putExtra(Intent.EXTRA_STREAM, uri);

    // Broadcast the Intent.
    startActivity(Intent.createChooser(share, "Share to"));
}
Vishal Gaur
  • 658
  • 6
  • 18