我已经在 android 中实现了 Facebook 应用程序请求。现在我可以向用户发送请求,但我的问题是,当用户从 facebook 应用程序中选择应用程序请求时,它会收到 facebook 错误。实际上我想要的是,当用户选择应用程序请求时,它会重定向到应用程序或 android 市场链接。在这里,我附上了应用程序请求的屏幕和代码。请帮我。
请求代码 :
if(facebook.isSessionValid()) {
// A request showing how to send extra data that could signify a gift
Bundle params = new Bundle();
params.putString("message", "Learn how to make your Android apps social");
params.putString("title", "cRoNy Invite friends");
params.putString("data",
"{\"badge_of_awesomeness\":\"1\"," +
"\"social_karma\":\"5\"}");
facebook.dialog(App.this, "apprequests", params, new DialogListener() {
@Override
public void onComplete(Bundle values) {
final String returnId = values.getString("request");
if (returnId != null) {
// Show the request Id if request sent successfully
Log.e("CD","Request Id : "+ returnId);
Toast.makeText(getApplicationContext(),
"Request sent: " + returnId,
Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFacebookError(FacebookError error) {
Log.e("CD","Facebook Error : "+ error);
Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onError(DialogError e) {
Log.e("CD","Facebook Error : "+ e);
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onCancel() {
// Show a message if the user cancelled the request
Toast.makeText(getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
});
} else {
// If the session is not valid show a message
Toast.makeText(getApplicationContext(), "You need to login to use send requests.",
Toast.LENGTH_LONG).show();
}
和 Facebook 错误消息: