Skip to content

Refactored Android support to use EncryptedSharedPreferences. This el… - #1

Merged
kito99 merged 1 commit into
masterfrom
upgrade-android-shared-preferences-encryption
Sep 20, 2023
Merged

Refactored Android support to use EncryptedSharedPreferences. This el…#1
kito99 merged 1 commit into
masterfrom
upgrade-android-shared-preferences-encryption

Conversation

@kito99

@kito99 kito99 commented Sep 20, 2023

Copy link
Copy Markdown

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
kito99 requested a review from BalusC September 20, 2023 16:13

@BalusC BalusC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kito99
kito99 merged commit 5e89d63 into master Sep 20, 2023
@kito99

kito99 commented Sep 20, 2023

Copy link
Copy Markdown
Author

See also: epicshaggy#103

@kito99

kito99 commented Sep 20, 2023

Copy link
Copy Markdown
Author

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>

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.

2 participants