I am making an app that uses twitter digits, and I was wondering if there is a way to use it without using the ugly twitter digits button that says "use my phone number"
You have to modify the button programmatically, using xml won't work. For example:
digitsButton.setText("Your text here");
digitsButton.setBackgroundColor(getResources().getColor(R.color.primary));
You can use your own button and just call Digits.authenticate()
final AuthCallback digitsCallback = new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
// Do something on success
}
@Override
public void failure(DigitsException exception) {
// Do something on failure
}
};
findViewById(R.id.myButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Digits.authenticate(digitsCallback);
}
});
Try this the OnClickListener of your custom button:
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);
By now you even got an answer. But just in case, most easy way to customize the DigitsAuth Button would be following below:
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With