Share photo on Google Plus using android sdk not by Share Intent

随声附和 提交于 2019-12-01 12:00:12

问题


I have integrated Google+ using its android sdk and able to get PlusClient object as well. I got basic information from here. In the same page at bottom there is another link for interactive post from where i got the below code which share the content. But its opening dialog and then share it.

Code :-

Button shareButton = (Button) findViewById(R.id.share_button);
shareButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      // Launch the Google+ share dialog with attribution to your app.
      Intent shareIntent = new PlusShare.Builder(this)
          .setType("text/plain")
          .setText("Welcome to the Google+ platform.")
          .setContentUrl(Uri.parse("https://developers.google.com/+/"))
          .getIntent();

      startActivityForResult(shareIntent, 0);
    }
});

My case is different as I have Image and Text already with me in my app, i just want to share them on the Google+ without any user interaction (except the login/sigin of user who wants to share it). And immediately after sharing the photo+text i will remove/clear the login of the user. So i only want to ask user for the authentication and the dialog for share should not appear. There will be a single button name Share on G+ by clicking that button app will ask user for authentication and share the photo+text already selected by user.

IMP NOTE :- Only user authentication pop up should be displayed and there after it must share the photo+text without any user interaction.

I need some guidance on this as i have already integrated the android-sdk and i also have it working, Now only thing is sharing without user interaction. Please if anyone has any idea on this kindly help/guide me.


回答1:


This is not possible. Sharing to Google+ must always be user-initiated, which ultimately makes for a better user experience when other users see a share from your app--they know that it has context for them.

The user interaction is actually pretty minimal. Once they hit the Share button, they will be taken to a share dialog that already has the content you have pre-populated. They can add a comment and some people they think would enjoy the post, and that's it.




回答2:


You can roll your own google plus posts for your app.

https://developers.google.com/+/domains/posts/creating



来源:https://stackoverflow.com/questions/18955084/share-photo-on-google-plus-using-android-sdk-not-by-share-intent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!