android: persist Amplitude device id when not set externally

Co-authored-by: Titus-Andrei Moldovan <moldovan.titus@gmail.com>
This commit is contained in:
tmoldovan8x8 2020-04-30 14:12:09 +03:00 committed by GitHub
parent 47bc6f0470
commit 2085851179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,10 @@ class AmplitudeModule
String android_id = sharedPreferences.getString(AMPLITUDE_DEVICE_ID_KEY, "");
if (!TextUtils.isEmpty(android_id)) {
Amplitude.getInstance(instanceName).setDeviceId(android_id);
} else {
String amplitudeId = Amplitude.getInstance(instanceName).getDeviceId();
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(JITSI_PREFERENCES, amplitudeId).apply();
}
}