我在我的应用程序中使用 facebook sdk 3。我想获取一些要在我的应用程序中使用的用户信息。如果我在我的设备中安装了 facebook 应用程序,它工作得很好。它要求登录,如果它没有登录并且可以工作。但即使设备上没有安装 facebook 应用程序,我也希望我的应用程序能够正常工作。我该怎么做。我的代码如下。请帮忙
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
// make request to the /me API
Request.executeMeRequestAsync(session,
new Request.GraphUserCallback() {
// callback after Graph API response with user
// object
@Override
public void onCompleted(GraphUser graphuser,
Response response) {
L
if (graphuser != null) {
GraphObject graphObject = response
.getGraphObject();
Log.i(" facebookLogin Email is ",
"value"
+ graphObject
.getProperty("email"));
User user = getUserDetails(graphObject,
graphuser.getId());
sendFBCredentialsToServer(user);
updateSharedPrefsWithFacebookCredentials(user);
}
}
});
Toast.makeText(getApplicationContext(),
"Pls wait , Fetching data", Toast.LENGTH_LONG)
.show();
}
}
});