我正在尝试创建一个应用程序,您可以通过Facebook请求对话框“邀请”或告诉您的朋友. https://developers.facebook.com/docs/howtos/androidsdk/3.0/send-requests/
它有些奏效,但我需要做的一件事就是知道将请求发送给谁.我怎样才能做到这一点?
我还有一个次要问题,即请求通知仅显示在用户应用程序上,而不显示在桌面页面上.有人知道吗?
请求代码:
private voID sendRequestDialog() { Bundle params = new Bundle(); params.putString("message", "!"); WebDialog requestsDialog = ( new WebDialog.RequestsDialogBuilder(MyPage.this, Session.getActiveSession(), params)) .setonCompleteListener(new OnCompleteListener() { @OverrIDe public voID onComplete(Bundle values, FacebookException error) { if (error != null) { if (error instanceof FacebookOperationCanceledException) { Toast.makeText(MyPage.this, "Inbjudan avbruten", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MyPage.this, "Nätverksfel, kontrollera din anslutning och försök igen", Toast.LENGTH_SHORT).show(); } } else { final String requestID = values.getString("request"); if (requestID != null) { Toast.makeText(MyPage.this, "Inbjudan skickad", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MyPage.this, "Inbjudan avbruten", Toast.LENGTH_SHORT).show(); } } } }) .build(); requestsDialog.show(); }
如果有人可以帮助我,我将非常感谢!
谢谢
解决方法:
抱歉缩进
Bundle params = new Bundle(); RequestsDialogBuilder builder = new WebDialog.RequestsDialogBuilder(activity, Session.getActiveSession(), params); builder.setonCompleteListener(new OnCompleteListener() {@OverrIDepublic voID onComplete(Bundle values, FacebookException error) {if (error == null) { if (values.containsKey("request")) { Set<String> keys = values.keySet(); for(String key:keys) { if(key.contains("to[")) { //I kNow this keys are horrible, but that's how facebook dID it //Here you have the ID's to do something with it Logger.d("FACEBOOK", "key " + key + " vlaue " + values.getString(key)); } } } else { if (Listener instanceof IFacebookCancelableListener) { ((IFacebookCancelableListener) Listener).onCancel(); } }} else if (error instanceof FacebookOperationCanceledException) { if (Listener instanceof IFacebookCancelableListener) { ((IFacebookCancelableListener) Listener).onCancel(); }} else { //Error}}});WebDialog dialog = builder.build();dialog.show();
总结 以上是内存溢出为你收集整理的获取请求已发送到Facebook Android的用户全部内容,希望文章能够帮你解决获取请求已发送到Facebook Android的用户所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)