As it seemed like there aren't any HintRequest Wrapper already made, I started looking for a way to implement it on my own using Java Codes that I found here and there. After a lot of looking around I gathered this bit of code:
I thought this should create something like this:
But obviously I am doing something wrong in my implementation.
I was calling the loadhintClicked() method by JavaObject here:
But it is not working.
I have to somehow implement HintRequest in my app for the user to select their phone number.
Please help me with solving this problem. Could be made as a library for others as well?
Java:
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
//import android.support.annotation.NonNull;
//import android.support.v7.app.AppCompatActivity;
//import android.support.v7.widget.Toolbar;
import com.google.android.gms.auth.api.credentials.Credential;
import com.google.android.gms.auth.api.credentials.CredentialPickerConfig;
import com.google.android.gms.auth.api.credentials.CredentialRequest;
import com.google.android.gms.auth.api.credentials.CredentialRequestResponse;
import com.google.android.gms.auth.api.credentials.Credentials;
import com.google.android.gms.auth.api.credentials.CredentialsClient;
import com.google.android.gms.auth.api.credentials.CredentialsOptions;
import com.google.android.gms.auth.api.credentials.HintRequest;
import com.google.android.gms.auth.api.credentials.IdToken;
import com.google.android.gms.auth.api.credentials.IdentityProviders;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
private CredentialsClient mCredentialsClient;
private Credential mCurrentCredential;
private static final int RC_HINT = 2;
private boolean mIsResolving = false;
public void loadHintClicked(String EventName) {
HintRequest hintRequest = new HintRequest.Builder()
.setHintPickerConfig(new CredentialPickerConfig.Builder()
.setShowCancelButton(true)
.build())
//.setIdTokenRequested(shouldRequestIdToken())
.setEmailAddressIdentifierSupported(true)
.setAccountTypes(IdentityProviders.GOOGLE)
.build();
;
PendingIntent intent = mCredentialsClient.getHintPickerIntent(hintRequest);
try {
startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0);
mIsResolving = true;
} catch (IntentSender.SendIntentException e) {
//Log.e(TAG, "Could not start hint picker Intent", e);
mIsResolving = false;
}
}
I thought this should create something like this:
But obviously I am doing something wrong in my implementation.
I was calling the loadhintClicked() method by JavaObject here:
B4X:
nativeMe = Me
nativeMe.RunMethod("loadHintClicked", Array("MyEvent"))
But it is not working.
I have to somehow implement HintRequest in my app for the user to select their phone number.
Please help me with solving this problem. Could be made as a library for others as well?