简体   繁体   中英

Share image to Google+ in Android app?

I'm working on a project that needs share image from my app to Google+. But when find out some samples relating to my problems, they requires installed Google+ from Google Play for sharing anything. So the question is : How can I share from my app without installing any extra app? Or install Google+ from Google Play is the only way to solve my problem?

Thank you for your attention!

Hope May this help you...

File tmpFile = new File("/path/to/image");
 final String photoUri = MediaStore.Images.Media.insertImage(
         getContentResolver(), tmpFile.getAbsolutePath(), null, null);

 Intent shareIntent = ShareCompat.IntentBuilder.from(this)
         .setText("Hello from Google+!")
         .setType("image/jpeg")
         .setStream(Uri.parse(photoUri))
         .getIntent()
         .setPackage("com.google.android.apps.plus");

The Google+ app only supports content:// URIs. You will need to use the MediaStore API for this...

I guess you can always take a look at the web api if they provide you with means to authenticate your user and upload posts with an image.

I assume however, that simply using the app itself will save you a lot of hassle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM