|
@@ -17,6 +17,8 @@
|
17
|
17
|
package org.jitsi.meet.sdk;
|
18
|
18
|
|
19
|
19
|
import android.annotation.SuppressLint;
|
|
20
|
+import android.content.Context;
|
|
21
|
+import android.content.SharedPreferences;
|
20
|
22
|
import android.provider.Settings;
|
21
|
23
|
import android.text.TextUtils;
|
22
|
24
|
|
|
@@ -40,6 +42,8 @@ class AmplitudeModule
|
40
|
42
|
extends ReactContextBaseJavaModule {
|
41
|
43
|
|
42
|
44
|
public static final String NAME = "Amplitude";
|
|
45
|
+ public static final String JITSI_PREFERENCES = "jitsi-preferences";
|
|
46
|
+ public static final String AMPLITUDE_DEVICE_ID_KEY = "amplitudeDeviceId";
|
43
|
47
|
|
44
|
48
|
public AmplitudeModule(ReactApplicationContext reactContext) {
|
45
|
49
|
super(reactContext);
|
|
@@ -58,8 +62,8 @@ class AmplitudeModule
|
58
|
62
|
Amplitude.getInstance(instanceName).initialize(getCurrentActivity(), apiKey);
|
59
|
63
|
|
60
|
64
|
// Set the device ID to something consistent.
|
61
|
|
- String android_id
|
62
|
|
- = Settings.Secure.getString(getReactApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
|
|
65
|
+ SharedPreferences sharedPreferences = getReactApplicationContext().getSharedPreferences(JITSI_PREFERENCES, Context.MODE_PRIVATE);
|
|
66
|
+ String android_id = sharedPreferences.getString(AMPLITUDE_DEVICE_ID_KEY, "");
|
63
|
67
|
if (!TextUtils.isEmpty(android_id)) {
|
64
|
68
|
Amplitude.getInstance(instanceName).setDeviceId(android_id);
|
65
|
69
|
}
|