Authenticating with BiometricPrompt during OnResume()
See original GitHub issueXamarin.Android Version (eg: 6.0):
9.0
Operating System & Version (eg: Mac OSX 10.11):
Winsdows 10
Support Libraries Version (eg: 23.3.0):
AndroidX v1.0.0-rc1
Describe your Issue:
W/BiometricPromptCompat( 5060): Not launching prompt. authenticate() called after onSaveInstanceState()
Calling the Biometric Prompt during OnResume() dismisses the dialog with an error saying that the prompt cannot be launched after onSaveInstanceState() has been called.
Wrapping the call to BiometricManager in a fragment transaction with CommitAllowingStateLoss() also does not have any effect
Steps to Reproduce (with link to sample solution if possible):
Calling the Biometric Prompt during OnResume()
public async Task<bool> Authenticate(CancellationToken cancellationToken)
{
var promptInfo = new BiometricPrompt.PromptInfo.Builder()
.SetTitle("Login")
.SetNegativeButtonText("Cancel")
.Build();
var activity = _activityResolver();
var executor = Executors.NewSingleThreadExecutor();
var handler = new BiometricsAuthenticationHandler();
using var dialog = new BiometricPrompt((FragmentActivity) activity, executor, handler);
await using (cancellationToken.Register(() => dialog.CancelAuthentication()))
{
dialog.Authenticate(promptInfo);
return await handler.Task;
}
}
Include any relevant Exception Stack traces, build logs, adb logs:
W/BiometricPromptCompat( 5060): Not launching prompt. authenticate() called after onSaveInstanceState()
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Biometric Prompt in onResume throws FragmentManager ...
I resolved the issue by calling the biometric prompt on fragment instead of activity. The change was biometricPrompt = BiometricPrompt(this ...
Read more >Login with Biometrics on Android
Biometric login provides a convenient method for authorizing access to private content within your app. Instead of having to remember an account username...
Read more >How To Make A Login Activity With Biometrics Support On ...
User can then click the biometric login button to bring up a platform-specific dialog, and go through the biometric authentication process to ...
Read more >A Guide to Implement Biometric Authentication
This function first checks if the device can authenticate using biometric or not. If it does, it creates a BiometricPrompt for encryption and ......
Read more >BiometricPrompt.java
A class that manages a system-provided biometric prompt. On devices running Android 9.0 (API ... An error code that may be returned during...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
And thanks - I did have a good day. Finished Material 1.1.0 bindings (recently released by google).
@bradleygunn
Would you be so kind and create minimal sample, so we can add it to the samples, please?
Short readme would be even greater.
That would help other users a lot. Thanks.
And of course you could close this issue yourself.