I would like to encourage user engagement in my app by rewarding them with a once off advantage (a kind of power-up I guess) when they share something on social media (twitter, Google+ or Facebook).
My first question is, is this considered acceptable by the Google Play store?
My next question (assuming the answer to my first is yes), is how to be sure the user has completed the share so I do not reward cancelled share intents?
My initial attempt has focussed on Facebook and I have set up the Facebook SDK, registered my App with Facebook and can complete a share, but as others have shown the share result is the same regardless of whether the user cancelled or posted. I note that similar questions have been asked here and here. But none of these have satisfactory solutions.
This answer sounds promising, but I don't recognise the "Session" type as part of the Facebook SDK .
My implementation at the moment uses this in a fragment in response to the user's button press:
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("My Title")
.setContentDescription("My Description.")
.setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=com.cloudforge.svn.bbarrett.floattiles"))
.build();
MainActivity.shareDialog.show(linkContent);
Then in my Main Activity I have the method:
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
I note from debug here that "resultCode" is -1 when the user cancels and when they post.
Finally in the MainActivity.onCreate() method I have:
FacebookSdk.sdkInitialize(this.getApplicationContext());
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
// TODO Auto-generated method stub
if(result.getPostId()!=null){
Toast.makeText(getBaseContext(), "User posted! (but this is never called as postId is always null)", Toast.LENGTH_LONG).show();
}else{
Toast.makeText(getBaseContext(), "User didn't post? (but this is called even when they have posted as postId is always null)", Toast.LENGTH_LONG).show();
}
}
@Override
public void onCancel() {
// TODO Auto-generated method stub
Toast.makeText(getBaseContext(), "User Cancelled (but this is never called)", Toast.LENGTH_LONG).show();
}
@Override
public void onError(FacebookException error) {
// TODO Auto-generated method stub
Toast.makeText(getBaseContext(), "Exception occurred", Toast.LENGTH_LONG).show();
}
});
I dont think my users will be particularly motivated to share unless they gain a game advantage from doing so, so I am really hoping someone can help me confirm a successful Facebook post (I'll deal with Google+ and twitter next!).
Thank you in advance for all reads, upvotes and answers.