Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realtime RC QA #1448

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions config/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,22 @@ dependencies {
implementation 'com.google.android.material:material:1.7.0'

// Import the Firebase BoM (see: https://firebase.google.com/docs/android/learn-more#bom)
implementation platform('com.google.firebase:firebase-bom:31.1.1')
implementation platform('com.google.firebase:firebase-bom:31.2.0')

// Firebase Remote Config (Java)
implementation 'com.google.firebase:firebase-config'
implementation 'com.google.firebase:firebase-config:21.2.1'

// Firebase Remote Config (Kotlin)
implementation 'com.google.firebase:firebase-config-ktx'

// For an optimal experience using Remote Config, add the Firebase SDK
// for Google Analytics. This is recommended, but not required.
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-annotations:16.2.0'

implementation 'com.google.firebase:firebase-installations-interop:17.1.0'
implementation 'com.google.firebase:firebase-installations:17.1.0'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test:rules:1.5.0'
Expand Down
1 change: 1 addition & 0 deletions config/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.remoteconfig.ConfigUpdate;
import com.google.firebase.remoteconfig.ConfigUpdateListener;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
import com.google.samples.quickstart.config.R;
import com.google.samples.quickstart.config.databinding.ActivityMainBinding;
Expand Down Expand Up @@ -74,7 +78,7 @@ public void onClick(View v) {
// Setting to set the minimum fetch interval.
// [START enable_dev_mode]
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(3600)
.setMinimumFetchIntervalInSeconds(0)
.build();
mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);
// [END enable_dev_mode]
Expand All @@ -87,7 +91,24 @@ public void onClick(View v) {
mFirebaseRemoteConfig.setDefaultsAsync(R.xml.remote_config_defaults);
// [END set_default_values]

fetchWelcome();
mFirebaseRemoteConfig.addOnConfigUpdateListener(new ConfigUpdateListener() {
@Override
public void onUpdate(@NonNull ConfigUpdate configUpdate) {
Log.i(TAG, "Received Realtime Signal");
if (configUpdate.getUpdatedKeys().contains("realtime_rc_changed_params")) {
Log.i(TAG, "Received realtime_rc_changed_params");
}
mFirebaseRemoteConfig.activate().onSuccessTask((task) -> {
displayWelcomeMessage();
return Tasks.forResult(null);
});
}

@Override
public void onError(FirebaseRemoteConfigException error) {
Log.i(TAG, "Got error: " + error.toString());
}
});
}

/**
Expand Down
8 changes: 7 additions & 1 deletion config/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
buildscript {
repositories {
mavenLocal()
maven {
url '.m2/repository'
}
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
}
Expand All @@ -17,6 +20,9 @@ allprojects {
repositories {
//mavenLocal() must be listed at the top to facilitate testing
mavenLocal()
maven {
url '.m2/repository'
}
google()
mavenCentral()
}
Expand Down
1 change: 1 addition & 0 deletions config/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down