Flickr, tumblr, instagram share intent in android

I want to share the image of flickr, tumblr, instagram. I want to do this with these 3 installed applications. I found for instagram

Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); shareIntent.putExtra(Intent.EXTRA_TEXT, "" + getShareText()); shareIntent.putExtra(Intent.EXTRA_SUBJECT, "" + getShareText()); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file.getAbsolutePath())); shareIntent.setPackage("com.instagram.android"); 

Can i have tumblr and flickr? Yes, I can do with the oauth process by integrating libraries. But I want to share through a specific installed application.

Help!! Thanks.

+2
source share
3 answers

Just set the correct package name to:

 sendIntent.setPackage(PACKAGE_NAME); 
  • Tumblr: com.tumblr
  • Flickr: com.yahoo.mobile.client.android.flickr

You can find package names in the Google Play Store URLs:

https://play.google.com/store/apps/details?id=PACKAGE_NAME

PS: it’s better to check if the application is installed on the device first:

  try { getPackageManager().getApplicationInfo(PACKAGE_NAME, 0); } catch (PackageManager.NameNotFoundException e) { // Twitter not installed } 

Sharing using SEND_ACTION does not require OAUTH in your application, auth is managed in the target application.

thanks

+6
source

If you delete the last line (setPackage), all installed applications that can handle sending images will be displayed in the application selection dialog box, including tumblr and flickr. If you want to limit applications to only the three applications you mentioned: why do you need it? You simply limit what the user can do with your application. In any case, I do not think this is possible.

+1
source

More information on creating Android intentions for images and videos can be found at http://instagram.com/developer/mobile-sharing/android-intents/

0
source

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


All Articles