내가에서이 가이드를 따라 페이스 북 3.0 SDK의 로그인을 사용하기 위해 노력하고있어 사망 페이스 북의 개발자 : https://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/authenticate/페이스 북 SDK 3.0 로그인 - 페이스 북 프로세스는
내 문제가 있음을 사용자가 로그인 버튼을 클릭하면, 내 활동이 종료되고 Facebook의 프로세스가 종료됩니다.
08-20 12:17:40.124 353-353/system_process I/ActivityManager: START u0 {act=SSO_WITH_FALLBACK cmp=com.my.app/com.facebook.LoginActivity (has extras)} from pid 30362
08-20 12:17:40.434 353-370/system_process I/ActivityManager: Displayed com.my.app/com.facebook.LoginActivity: +268ms
08-20 12:17:44.094 353-546/system_process I/ActivityManager: Start proc android.process.acore for content provider com.android.providers.contacts/.ContactsProvider2: pid=30500 uid=10014 gids={50014, 3003, 1015, 1028}
08-20 12:17:44.134 30500-30500/android.process.acore E/Trace: error opening trace file: No such file or directory (2)
08-20 12:17:45.494 353-12974/system_process I/ActivityManager: Process com.facebook.katana:dash (pid 30233) has died.
내 문제에 대한 어떤 제안 :
이 안드로이드 스튜디오에서 로그 캣은? 편집
: 여기 는 주요 활동의 코드
public class MainActivity extends FragmentActivity {
public static final boolean D = SystemConstants.ACTIVE_DEBUG;
public static final String TAG = "MainActivity";
private static final int SPLASH = 0;
private static final int SELECTION = 1;
private static final int FRAGMENT_COUNT = SELECTION +1;
private Fragment[] fragments = new Fragment[FRAGMENT_COUNT];
private boolean isResumed = false;
private UiLifecycleHelper uiHelper;
private Session.StatusCallback callback =
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
uiHelper = new UiLifecycleHelper(this, callback);
uiHelper.onCreate(savedInstanceState);
setContentView(R.layout.main);
FragmentManager fm = getSupportFragmentManager();
fragments[SPLASH] = fm.findFragmentById(R.id.splashFragment);
fragments[SELECTION] = fm.findFragmentById(R.id.selectionFragment);
FragmentTransaction transaction = fm.beginTransaction();
for (Fragment fragment : fragments) {
transaction.hide(fragment);
}
transaction.commit();
}
/**
* Configure files destinations.
*/
private void configureEnvironment() {
File sd = Environment.getExternalStorageDirectory();
if (sd.canWrite()) {
File destination = new File(sd, SettingConstants.BASE_DIR);
if (!destination.mkdir() && !destination.isDirectory()) {
Log.e(TAG, "Unable to create Base Directory.");
Tracking.sendException(new IllegalStateException("Unable to create Base Directory."));
}
File audio = new File(sd, SettingConstants.AUDIO_DIR);
if (!audio.mkdir() && !audio.isDirectory()) {
Log.e(TAG, "Unable to create Audio Directory.");
Tracking.sendException(new IllegalStateException("Unable to create Audio Directory."));
}
File avatar = new File(sd, SettingConstants.AVATAR_DIR);
if (!avatar.mkdir() && !avatar.isDirectory()) {
Log.e(TAG, "Unable to create Avatar Directory.");
Tracking.sendException(new IllegalStateException("Unable to create Avatar Directory."));
}
File image = new File(sd, SettingConstants.IMAGE_DIR);
if (!image.mkdir() && !image.isDirectory()) {
Log.e(TAG, "Unable to create Image Directory.");
Tracking.sendException(new IllegalStateException("Unable to create Image Directory."));
}
File video = new File(sd, SettingConstants.VIDEO_DIR);
if (!video.mkdir() && !video.isDirectory()) {
Log.e(TAG, "Unable to create Video Directory.");
Tracking.sendException(new IllegalStateException("Unable to create Video Directory."));
}
}
}
/**
* Shows a fragment
* @param fragmentIndex
* @param addToBackStack
*/
private void showFragment(int fragmentIndex, boolean addToBackStack) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
for (int i = 0; i < fragments.length; i++) {
if (i == fragmentIndex) {
transaction.show(fragments[i]);
} else {
transaction.hide(fragments[i]);
}
}
if (addToBackStack) {
transaction.addToBackStack(null);
}
transaction.commit();
}
/**
* called due to session state changes. The method shows the relevant fragment based on the person's authenticated state.
* @param session Facebook Session
* @param state Facebook login state
* @param exception Eventual exception
*/
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
// Only make changes if the activity is visible
if (isResumed) {
FragmentManager manager = getSupportFragmentManager();
// Get the number of entries in the back stack
int backStackSize = manager.getBackStackEntryCount();
// Clear the back stack
for (int i = 0; i < backStackSize; i++) {
manager.popBackStack();
}
if (state.isOpened()) {
// If the session state is open:
// Show the authenticated fragment
showFragment(SELECTION, false);
} else if (state.isClosed()) {
// If the session state is closed:
// Show the login fragment
showFragment(SPLASH, false);
}
}
}
/**
* case where fragments are newly instantiated and the authenticated versus nonauthenticated UI needs to be properly set.
*/
@Override
protected void onResumeFragments() {
super.onResumeFragments();
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// if the session is already open,
// try to show the selection fragment
showFragment(SELECTION, false);
} else {
// otherwise present the splash screen
// and ask the person to login.
showFragment(SPLASH, false);
}
}
@Override
protected void onStart() {
super.onStart();
Tracking.startActivityTracking(this);
}
@Override
protected void onStop() {
super.onStop();
Tracking.stopActivityTracking(this);
}
@Override
public void onResume() {
super.onResume();
uiHelper.onResume();
isResumed = true;
}
@Override
public void onPause() {
super.onPause();
uiHelper.onPause();
isResumed = false;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
uiHelper.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onDestroy() {
super.onDestroy();
uiHelper.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
uiHelper.onSaveInstanceState(outState);
}
}
편집의 2 : 에뮬레이터에 APK 그것은, 웹보기를 보여줍니다 설치되지 않은 페이스 북은 로그인을 요청 주어진 동일한 오류를 제공 시도 그런 다음 활동을 닫습니다. MainActivity의 마지막 호출은 메서드 추적 로깅을 추가했습니다. onDestroy ...
문제는이 줄에 있다고 생각합니다 ** 해당 파일 또는 디렉토리 없음 (**) **. 로그인 후 무엇을하려고합니까? –
나는 다른 조각으로의 전환을 시작합니다.이 코드는 실제로이 튜토리얼에서 복사 된 것입니다 ... 이것은 이상합니다 –