Reputation: 1279
I have successfully built my android app to support sharing on facebook. The problem is when someone shares something there is a link that facebook adds for me automatically that says shared via "my app name". If I click on it, a error occurs on facebook *note this link is usually on facebook and says shared via mobile or shared via android
error code- The page you requested was not found. You may have clicked an expired link or mistyped the address. Some web addresses are case sensitive.
How can i fix this link or where do i set it? *I think this may be set on the settings on facebook but am unsure
my code to share comment
facebook.dialog(this, "feed", new DialogListener() {
@Override
public void onFacebookError(FacebookError e) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onComplete(Bundle values) {
}
@Override
public void onCancel() {
}
});
Upvotes: 2
Views: 248
Reputation: 7041
If you're using the facebook android API, you should do this
private Facebook mFacebook;
private String mMessageToPost;
...
function postToWall(urMessageAndLink)
{
Bundle parameters = new Bundle();
parameters.putString("message", urMessageAndLink);
parameters.putString("description", theTopic);
facebook.request("xx");
String response = mFacebook.request("xx/feed", parameters, "POST");
}
facebook.dialog(this, "feed", new DialogListener() {
public void onComplete(Bundle values) {
if (mMessageToPost != null) {
postToWall(mMessageToPost);
}
}
public void onFacebookError(FacebookError error) {
showToast("Error!!");
finish();
}
public void onError(DialogError error) {
showToast("Error!!");
finish();
}
public void onCancel() {
showToast("Facebook sharing cancelled!");
finish();
}
}
You can also use the android share API (but that requires theuser to have the facebook app, the share API opens a dialog box to choose any existing app that supports sharing)
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
String textMsg = "http://the.link.you.want.to.send";
i.putExtra(Intent.EXTRA_TEXT, textMsg);
startActivity(Intent.createChooser(i, aTitle));
Upvotes: 5