I'm trying to share some content's on facebook but i have a lot of problems. i've add the correct keyhash, and created the app on facebook and put it live. When i try to share something it seems good as you can see:
But after i've clicked on post it's empty:
It's a permission problem? i've read a lot about this on stack but i can't find an answer that works... That's the code :
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
case R.id.action_share:
Intent intent2=new Intent(Intent.ACTION_SEND);
intent2.setType("text/plain");
intent2.putExtra(Intent.EXTRA_TEXT,"'"+ random + "'" + "\n"+"By Random Quotes");
startActivity(Intent.createChooser(intent2, "Share via"));
break;
case R.id.randombut:
Frasi();
case android.R.id.home:
Intent homeIntent = new Intent(this, MainActivity.class);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(homeIntent);
break;
case R.id.facebook:
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
.setApplicationName("Random Quotes")
.setDescription(random)
.setPicture("https://lh6.ggpht.com/1UJ89ho9pvVLPYS6NsFVQdb7KoQPALMhkw1w7DnNDqcfDYJ-tRxruaf2YLMLyqhnG_g=w300-rw")
.setLink("https://play.google.com/store/apps/details?id=com.techappstudios.randomquotes")
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
}
return true;
}
I had a similar problem.
I fixed it by changing where the picture came from (don't ask me why this worked because I really don't know).
Instead of grabbing my picture URL from websites such as facebook or google play, I uploaded the picture to gethub. With gethub, the picture url ended in a .png. The picture, link and description posted as they were supposed to.
Give this a try. I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With