简体   繁体   中英

Callback on posting to G+ user stream

When the user shares a link on their G+ stream through my Android app, how do I detect if the post was successful?

This is what I'm doing to post a link.

PlusShare.Builder builder = new PlusShare.Builder(ExampleActivity.this)
    .setType("text/plain")
    .setContentUrl(Uri.parse("http://example.com"))
    .setText("Check out this website");
Intent shareIntent = builder.getIntent();
startActivityForResult(shareIntent, GPLUS_SHARE_REQUEST_CODE);

I overrode onActivityResult to check the resultCode . It does return RESULT_OK if it is successful, but is it possible to get more elaborate information, like the post submission failing due to a network error etc?

There is not currently a callback function for a Share action. However, there is a known feature request for one in the G+ Platform Issue Tracker. If you Star the issue, you will receive email updates on it.

For Shares: https://code.google.com/p/google-plus-platform/issues/detail?id=232 For Interactive Posts specifically: https://code.google.com/p/google-plus-platform/issues/detail?id=521

For now, the RESULT_OK check is a decent solution.

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