Open the Instagram app from another Android app and send an image that says

Basically, I am looking to open an Instagram application from another application and send a caption image. IOS has some useful documentation. ( iPhone-hooks )

Does Instagram support custom actions on Android, like iOS, as described in iPhone hooks ?

Below is the current code used in my application to perform this task partially.

private void sendImageToIntagram(Activity activity) { Intent intent = activity.getPackageManager().getLaunchIntentForPackage("com.instagram.android"); if (intent != null) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setPackage("com.instagram.android"); String imagePath = ImageUtil.getProcessedImage().getAbsolutePath(); try { shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(activity.getContentResolver(), imagePath, "Title", "Description"))); // shareIntent.putExtra(Intent.EXTRA_TITLE, "Caption 01"); // shareIntent.putExtra(Intent.EXTRA_TEXT, "Caption 02"); // shareIntent.putExtra(Intent.EXTRA_SUBJECT,"Caption 03"); } catch (FileNotFoundException e) { e.printStackTrace(); } shareIntent.setType("image/jpeg"); activity.startActivity(shareIntent); } else { // bring user to the market to download the app. intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("market://details?id=" + "com.instagram.android")); activity.startActivity(intent); } } 

None of the above title, description, signature 01, signature 02, signature 03 does not work.

Then I tried using

shareIntent.setAction(Intent.ACTION_SEND); β†’ shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);

and

 shareIntent.setType("image/jpeg"); shareIntent.setType("image/*"); shareIntent.setType("*/*"); 

too, but none of the above work.

+4
source share
2 answers

Looking at this question and in particular this answer from Chriskot, it seems like Instagram has let you do this since July 2014.

Short story

 Intent instagram = new Intent(android.content.Intent.ACTION_SEND); instagram.setType("image/*"); instagram.putExtra(Intent.EXTRA_STREAM, [URI of photo]); instagram.putExtra(Intent.EXTRA_TEXT, [Text of caption]); instagram.setPackage(instagramPackageName); startActivity(instagram); 
+4
source

Short answer, No.

Instagram has no Android equivalent for iPhone hooks.

They support ACTION_SEND , but only consider Intent.EXTRA_STREAM at their end.

If something has changed in the last 4 months (I doubt it) that this guy took the stub on his code, you can assume from AndroidManifest.xml by looking at the Activity Catcher , which they only care about android.intent.extra.STREAM .

So, while you can not send any other data except the actual image.

+3
source

Source: https://habr.com/ru/post/955532/


All Articles