1
我是新手到Facebook集成到android應用程序。我試圖運行從Facebook getting started.應用程序,但它不工作。我沒有得到用戶名。爲什麼它不起作用?誰能幫我。安卓 - 臉譜示例不工作
我得到了以下一個會話變量。
session: {Session state:OPENING, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:360610310722942}
session opened: false
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// start Facebook Login
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state,
Exception exception) {
final TextView welcome = (TextView) findViewById(R.id.welcome);
System.out.println("session: " + session);
System.out.println("session opened: " + session.isOpened());
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 user,
Response response) {
if (user != null) {
welcome.setText("Hello "
+ user.getName() + "!");
}
}
});
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
System.out.println("onActivityResult");
Session.getActiveSession().onActivityResult(this, requestCode,
resultCode, data);
}
在哪種情況下沙盒模式啓用? – naresh
啓用已啓用。禁用爲禁用:|上面的屏幕截圖是禁用的沙盒模式。 – VAdaihiep