2014-12-16 2 views
1

트위터 자리를 통합 관리했는데 인증이 작동하지만 사용자가 이미 자신의 번호와 코드를 추가했는지 확인하고 싶습니다.Twitter Digits가 이미 인증되었는지 확인합니다.

final TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET); 
    Fabric.with(this, new Crashlytics(), new Twitter(authConfig)); 

그리고 버튼 이벤트 :

지금은

난 단지 인증 부분을

digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button); 
    digitsButton.setCallback(new AuthCallback() { 
     @Override 
     public void success(DigitsSession session, 
          String phoneNumber) { 
      // Do something with the session 
      Toast.makeText(WelcomeActivity.this,"Registration Successful",Toast.LENGTH_SHORT).show(); 
     } 

     @Override 
     public void failure(DigitsException exception) { 
      // Do something on failure 
      Toast.makeText(WelcomeActivity.this,"Registration Failed",Toast.LENGTH_SHORT).show(); 
     } 
    }); 

- 사용자가 이미이 단계를 만든 경우 내가 확인할 수있는 방법

?

답변

1

데이터를 어딘가에 저장하여 인증에 성공했다는 사실을 저장할 수 있습니다.

SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); 
boolean isAuthenticated = settings.getBoolean("ALREADY_AUTHENTICATED", false); 

그리고 인증하는지 (true) 성공했는지 설정하려면 콜백의 에 넣고 수 : Storage Options

인증 당신이 아래을 IsAuthenticated는 사용하는 것이 성공 여부를 확인하기 위해, 된 SharedPreferences를 사용하여 성공 방법

// We need an Editor object to make preference changes. 
// All objects are from android.context.Context 
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); 
SharedPreferences.Editor editor = settings.edit(); 
editor.putBoolean("ALREADY_AUTHENTICATED", true /** or false */); 

// Commit the edits! 
editor.commit(); 
+0

Sim 카드 변경을 어떻게 식별합니까? – Ika

관련 문제