[英]Can't send app request to friend on facebook for android
I need to send my android application installation request to users' friends. 我需要将我的android应用程序安装请求发送给用户的朋友。 Here is the sample code that I found on web. 这是我在网上找到的示例代码。 Everything works great here, I can select users then when I press Send Button, Toast shows that "Request sent". 在这里一切正常,我可以选择用户,然后按“发送”按钮,Toast会显示“请求已发送”。 But I cant see the request on profile that I have sent request. 但是我在发送请求的个人资料上看不到该请求。 What is wrong here? 怎么了
public class InviteFriends extends Activity {
Activity activity = this;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
sendRequestDialog();
}
private void sendRequestDialog() {
Bundle params = new Bundle();
params.putString("message", "Learn how to make your Android apps social");
params.putString("frictionless", "1");
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(activity,
Session.getActiveSession(),
params))
.setOnCompleteListener(new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(activity.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity.getApplicationContext(),
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(activity.getApplicationContext(),
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
})
.build();
requestsDialog.show();
}
}
I found my problem, 我发现了问题
Here is the keypoint: Facebook SDK v3.0 Request Dialog not sending application request 这是关键点: Facebook SDK v3.0请求对话框未发送应用程序请求
"From this Facebook developers page: "User to User Requests are only available for Canvas apps"" “在此Facebook开发人员页面上:“用户到用户请求仅适用于Canvas应用”
And then I searched for what I am trying to do: 然后我搜索了我想做的事情:
https://developers.facebook.com/docs/howtos/requests/#user_to_user https://developers.facebook.com/docs/howtos/requests/#user_to_user
As a result, I added new platform(An application on facebook) on facebook developers page's dashboard settings. 结果,我在Facebook开发人员页面的仪表板设置中添加了新平台(facebook上的应用程序)。 That's all, it is working now.. 就这样,它现在正在工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.