我正在尝试实现发送数据并在我的Facebook安卓游戏应用程序中接受该数据.我正在关注https://developers.facebook.com/docs/android/send-requests/#notifications教程.我能够发送请求但是我无法接受收件人方面的数据.
我intentUri每次都返回null,因此我无法获取requestIds.
我在收件人端获取数据的代码:
intentUri = MainActivity.this.getIntent().getData();
if (intentUri != null) {
String requestIdParam = intentUri.getQueryParameter("request_ids");
if (requestIdParam != null) {
String array[] = requestIdParam.split(",");
requestId = array[0];
Log.i("Request id: ", "Request id: " + requestId);
}else{
Log.i("Request id: ", "null" );
}
} else {
Log.i("intentUri", "null"); //**Always printing this part**
}
Run Code Online (Sandbox Code Playgroud)
onSessionStateChange()方法用于调用requestData方法
private void onSessionStateChange(Session session, SessionState state,Exception exception) {
if (state.isOpened() && requestId != null) {
getRequestData(requestId);
requestId = null;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用以下方法发送请求:
private …Run Code Online (Sandbox Code Playgroud) android facebook facebook-graph-api facebook-apps facebook-requests
我正在将Android应用程序更新为最新的Facebook SDK(4.0.0)。当我创建GameRequestDialog时,它向我显示以下消息:“游戏请求仅适用于游戏”,而不是显示我的facebook朋友。我以前在较旧的SDK中使用过WebDialog,但这没有发生。我尝试在sdk 4中使用WebDialog,但仍显示此消息。
更新:这是logcat的输出
{FacebookServiceException: httpResponseCode: -1, facebookErrorCode: 3405, facebookErrorType: null, message: Game Requests are only available to games.}
Run Code Online (Sandbox Code Playgroud) android facebook facebook-graph-api facebook-requests facebook-sdk-4.0