我正在開發一個項目,需要將我的應用中的圖片共享到Google+。 但是,當找出與我的問題相關的一些示例時,他們需要從Google Play安裝Google+才能分享任何內容。 所以問題是:我如何從我的應用程序分享,而無需安裝任何額外的應用程序?或者從Google Play安裝Google+是解決我的問題的唯一方法?在Android應用中將圖像分享到Google+?
感謝您的關注!
我正在開發一個項目,需要將我的應用中的圖片共享到Google+。 但是,當找出與我的問題相關的一些示例時,他們需要從Google Play安裝Google+才能分享任何內容。 所以問題是:我如何從我的應用程序分享,而無需安裝任何額外的應用程序?或者從Google Play安裝Google+是解決我的問題的唯一方法?在Android應用中將圖像分享到Google+?
感謝您的關注!
希望五月幫你...
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");
的Google+應用只支持內容://的URI。您需要爲此使用MediaStore
API ...
我想你總是可以看看web api,如果他們提供的手段來驗證你的用戶和上傳與圖像的職位。
但是,我認爲只是使用應用程序本身會爲您節省很多麻煩。
是的,您確實需要在設備中共享Google地址。 – Tarun
檢查是否安裝了g + errorCode = GooglePlusUtil.checkGooglePlusApp(this);如果(errorCode == GooglePlusUtil.SUCCESS)'然後分享圖像 – Tarun