Skip to content

Commit 1274b42

Browse files
authored
Fix some deprecations (#533)
* Implement Firebase segmentation SDK device local cache * [Firebase Segmentation] Add custom installation id cache layer and tests for it. * Add test for updating cache * Switch to use SQLiteOpenHelper * Switch to use SharedPreferences from SQLite. * Change the cache class to be singleton * Wrap shared pref commit in a async task. * Address comments * Google format fix * Replace some deprecated code.
1 parent 8b7380d commit 1274b42

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

firebase-segmentation/src/androidTest/java/com/google/firebase/segmentation/CustomInstallationIdCacheTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import static org.junit.Assert.assertNull;
1919
import static org.junit.Assert.assertTrue;
2020

21-
import androidx.test.InstrumentationRegistry;
21+
import androidx.test.core.app.ApplicationProvider;
2222
import androidx.test.ext.junit.runners.AndroidJUnit4;
2323
import com.google.android.gms.tasks.Tasks;
2424
import com.google.firebase.FirebaseApp;
@@ -41,11 +41,11 @@ public void setUp() {
4141
FirebaseApp.clearInstancesForTest();
4242
firebaseApp0 =
4343
FirebaseApp.initializeApp(
44-
InstrumentationRegistry.getContext(),
44+
ApplicationProvider.getApplicationContext(),
4545
new FirebaseOptions.Builder().setApplicationId("1:123456789:android:abcdef").build());
4646
firebaseApp1 =
4747
FirebaseApp.initializeApp(
48-
InstrumentationRegistry.getContext(),
48+
ApplicationProvider.getApplicationContext(),
4949
new FirebaseOptions.Builder().setApplicationId("1:987654321:android:abcdef").build(),
5050
"firebase_app_1");
5151
cache = CustomInstallationIdCache.getInstance();

firebase-segmentation/src/androidTest/java/com/google/firebase/segmentation/FirebaseSegmentationInstrumentedTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import static org.junit.Assert.assertNull;
1818

19-
import androidx.test.InstrumentationRegistry;
19+
import androidx.test.core.app.ApplicationProvider;
2020
import androidx.test.ext.junit.runners.AndroidJUnit4;
2121
import com.google.firebase.FirebaseApp;
2222
import com.google.firebase.FirebaseOptions;
@@ -39,7 +39,7 @@ public void setUp() {
3939
FirebaseApp.clearInstancesForTest();
4040
firebaseApp =
4141
FirebaseApp.initializeApp(
42-
InstrumentationRegistry.getContext(),
42+
ApplicationProvider.getApplicationContext(),
4343
new FirebaseOptions.Builder().setApplicationId("1:123456789:android:abcdef").build());
4444
}
4545

0 commit comments

Comments
 (0)