だから私は簡単な認証方法を書いていますが、何が起こるかというと、セッションがまったく開かれません...
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.*;
import android.util.Log;
import com.facebook.Request;
import com.facebook.Response;
import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.model.GraphUser;
public class FBAuth extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fbauth);
Log.v("AUTH","SESSION STARTING");
// start FB Login
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@SuppressWarnings("deprecation")
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Log.v("AUTH","SESSION ACTIVE");
// 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) {
Log.v("AUTH:","USERNAME: " + user.getFirstName());
TextView welcome = (TextView) findViewById(R.id.welcome);
welcome.setText("Hello " + user.getName() + "!");
}
}
});
}
else if (state.isClosed()) {
Log.v("AUTH", "SESSION CLOSED");
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
}
ログキャット:
10-16 15:58:21.104: V/AUTH(26525): SESSION STARTING
10-16 15:58:23.797: V/AUTH(26525): SESSION CLOSED
Facebook プロセスの Logcat:
10-16 16:01:49.598: I/ActivityManager(430): START u0 {act=SSO_WITH_FALLBACK cmp=com.mumin.facebookconnect/com.facebook.LoginActivity (has extras)} from pid 26525
10-16 16:01:49.818: I/ActivityManager(430): Displayed com.mumin.facebookconnect/com.facebook.LoginActivity: +222ms (total +290ms)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): com.facebook.http.protocol.ApiException: Key hash ********************** does not match any stored key hashes.
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:83)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:162)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.ApiResponse.h(ApiResponse.java:285)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:272)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:29)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:160)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:16)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.handler.PlatformOperationHandler.c(PlatformOperationHandler.java:366)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.handler.PlatformOperationHandler.a(PlatformOperationHandler.java:259)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.fbservice.service.BlueServiceQueue.e(BlueServiceQueue.java:296)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:53)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:230)
10-16 16:01:50.278: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.common.executors.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:59)
10-16 16:01:50.308: I/ActivityManager(430): START u0 {act=com.facebook.platform.PLATFORM_ACTIVITY cat=[android.intent.category.DEFAULT] pkg=com.facebook.katana cmp=com.facebook.katana/.platform.PlatformActivity (has extras)} from pid 26525
10-16 16:01:50.359: I/ActivityManager(430): START u0 {cmp=com.facebook.katana/.platform.PlatformWrapperActivity (has extras)} from pid 25219
10-16 16:01:50.849: I/ActivityManager(430): Displayed com.facebook.katana/.platform.PlatformActivity: +510ms
10-16 16:01:50.869: I/ActivityManager(430): Displayed com.facebook.katana/.platform.PlatformWrapperActivity: +500ms
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): com.facebook.http.protocol.ApiException: Key hash 1gcqjsUopNOpDvlaJ6a43CIaakA does not match any stored key hashes.
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:83)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:162)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.ApiResponse.h(ApiResponse.java:285)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:272)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:29)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:160)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:16)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.handler.PlatformOperationHandler.c(PlatformOperationHandler.java:366)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.katana.server.handler.PlatformOperationHandler.a(PlatformOperationHandler.java:259)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.fbservice.service.BlueServiceQueue.e(BlueServiceQueue.java:296)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:53)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:230)
10-16 16:01:52.471: W/fb4a(:<default>):BlueServiceQueue(25219): at com.facebook.common.executors.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:59)
10-16 16:01:52.511: W/fb4a(:<default>):GDPDialog(25219): com.facebook.fbservice.service.ServiceException: API_ERROR: API_ERROR
10-16 16:01:52.511: W/fb4a(:<default>):GDPDialog(25219): at com.facebook.fbservice.ops.BlueServiceOperation.c(BlueServiceOperation.java:637)
10-16 16:01:52.511: W/fb4a(:<default>):GDPDialog(25219): at com.facebook.fbservice.ops.BlueServiceOperation.c(BlueServiceOperation.java:45)
10-16 16:01:52.511: W/fb4a(:<default>):GDPDialog(25219): at com.facebook.fbservice.ops.BlueServiceOperation$2.run(BlueServiceOperation.java:602)
おそらくキーハッシュが悪いために認証が失敗したのではないかと思ったので、新しいものを生成しましたが役に立ちませんでした。