Allow using custom SharedPreferences, e.g. EncryptedSharedPreferences
alexeyvasilyev opened this issue · comments
Alexey Vasilyev commented
Right now it is impossible to use custom SharedPrefences file, e.g. EncryptedSharedPreferences. We need an ability to specify custom SharedPreferences via Analytics.Builder.
String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
SharedPreferences sharedPreferences = EncryptedSharedPreferences.create(
"secret_shared_prefs",
masterKeyAlias,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);
Analytics analytics = new Analytics.Builder(context, YOUR_WRITE_KEY)
.trackApplicationLifecycleEvents()
.recordScreenViews()
.sharedPreferences(sharedPreferences)
.build();
Alexey Vasilyev commented
Found solution to use Builder crypto(Crypto crypto)