Skip to content

Conversation

@kito99
Copy link

@kito99 kito99 commented Sep 20, 2023

Refactored Android support to use EncryptedSharedPreferences. This eliminates unnecessary encryption code and resolves crashes we saw on several Android 12 and 13 devices.

More info about EncryptedSharedPreferences: https://developer.android.com/reference/androidx/security/crypto/EncryptedSharedPreferences. Note the example uses https://developer.android.com/jetpack/androidx/releases/security 1.0, not 1.1 alpha (which is used for the code example on this page.)

This has been tested on several real devices using Android 10-13.

…iminates unnecessary encryption code and resolves crashes we saw on several Android 12 and 13 devices.
@kito99
Copy link
Author

kito99 commented Sep 20, 2023

In order to use this, you have to exclude the Native Biometric shared preferences file from backups:

In AndroidManifiest.xml:

<manifest ...>

    <application
      ...
        android:fullBackupContent="@xml/backup_rules">
    </application>
</manifest>

android/app/src/main/res/backup_rules.xml:

<full-backup-content>
    <include domain="sharedpref" path="."/>
    <exclude domain="sharedpref" path="NativeBiometricSharedPreferences"/>
</full-backup-content>

@AdlerJS
Copy link

AdlerJS commented Sep 23, 2023

@kito99 - Do you think this PR would fix the issue we are seeing in Cap-go#7.

If so would you mind opening this code change against the Cap-Go plugin which is being maintained by the Cap-Go team. Our company is also sponsoring a bounty on the issue so you would get paid for the work you've done here

@kito99
Copy link
Author

kito99 commented Sep 25, 2023

@danbunkr sure, I'll do that ASAP.

@BenRacicot
Copy link

@kito99 slammed into this issue last week/weekend. Thank you for your work on this PR.
Will it be available soon?

@natedouds
Copy link

Same question - when will this be available? We think this fixes a current fairly wide spread issue that we're facing.

@kito99
Copy link
Author

kito99 commented Dec 8, 2023 via email

@kito99
Copy link
Author

kito99 commented Feb 5, 2024

Is @jmartinezehp or anyone else on this project available to review?

@AdlerJS do you still want this applied to your fork?

@BenRacicot
Copy link

@kito99 thanks again for your effort on this. Does this mean Android support has returned?

@kito99
Copy link
Author

kito99 commented Feb 22, 2024

@BenRacicot afaik this PR fixes issues with Android support (we are using it in production). However, unless @AdlerJS still wants this PR on their fork, or the original maintainers like @jmartinezehp want the PR, there's not much I can do. We do have a fork that includes this PR available here: https://github.com/virtua-tech/capacitor-native-biometric. However, that's not necessarily a longterm option.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants