Skip to content

Instantly share code, notes, and snippets.

@rallat
Created October 23, 2014 07:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rallat/849a68520ca10d913aeb to your computer and use it in GitHub Desktop.
Save rallat/849a68520ca10d913aeb to your computer and use it in GitHub Desktop.
Digits with custom button
final AuthCallback authCallback = new AuthCallback() {
@Override
public void success(DigitsSession digitsSession, String s) {
//Success !!
}
@Override
public void failure(DigitsException e) {
//sad :(
}
};
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Digits.authenticate(authCallback);
}
});
@streamride
Copy link

Now it's deprecated

@geolyth
Copy link

geolyth commented Feb 29, 2016

Which is the alternative?

@Arkanayan
Copy link

Use DigitsAuthConfig Builder.

@MohamedHajr
Copy link

MohamedHajr commented Jul 11, 2016

Is there isn't a way to trigger it automatacly w ithout having to click

@frapeti
Copy link

frapeti commented Nov 17, 2016

AuthConfig.Builder builder = new AuthConfig.Builder();

                    builder.withAuthCallBack(new AuthCallback() {
                        @Override
                        public void success(DigitsSession session, String phoneNumber) {
                            Toast.makeText(getApplicationContext(), "Authentication successful for "
                                    + phoneNumber, Toast.LENGTH_LONG).show();

                             // Do something
                        }

                        @Override
                        public void failure(DigitsException error) {
                           // Do something
                        }
                    });

                    AuthConfig authConfig = builder.build();

                    Digits.authenticate(authConfig);

@Idimma
Copy link

Idimma commented Mar 24, 2017

It does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment