@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TwitterAuthConfig authConfig = new TwitterAuthConfig(Constants.TWITTER_KEY, Constants.TWITTER_SECRET); Fabric.with(this, new TwitterCore(authConfig), new Digits()); authCallback = new AuthCallback() { @Override public void success(DigitsSession session, String phoneNumber) { Toast.makeText(getBaseContext(), "Success", Toast.LENGTH_LONG).show(); startProfileActivity(phoneNumber); } @Override public void failure(DigitsException exception) { Toast.makeText(getBaseContext(), "Failure", Toast.LENGTH_LONG).show(); } }; setContentView(com.crimepunch.app.R.layout.activity_registration); DigitsAuthButton digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button); digitsButton.setCallback(authCallback); if (session.getUser(this) != null) { startHomeActivity(); } }
private void setUpDigitsButton() { phoneButton = (DigitsAuthButton) findViewById(R.id.phone_button); phoneButton.setAuthTheme(R.style.AppTheme); phoneButton.setCallback( new AuthCallback() { @Override public void success(DigitsSession digitsSession, String phoneNumber) { SessionRecorder.recordSessionActive("Login: digits account active", digitsSession); Answers.getInstance().logEvent("login:digits:success"); startThemeChooser(); } @Override public void failure(DigitsException e) { Answers.getInstance().logEvent("login:digits:failure"); Toast.makeText( getApplicationContext(), getResources().getString(R.string.toast_twitter_digits_fail), Toast.LENGTH_SHORT) .show(); Crashlytics.logException(e); } }); }