Skip to content

Commit 7cbb661

Browse files
committed
adding app build version for remote config
1 parent cdf06e2 commit 7cbb661

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

firebase-config/src/main/java/com/google/firebase/remoteconfig/RemoteConfigConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public final class RemoteConfigConstants {
4545
RequestFieldKey.PLATFORM_VERSION,
4646
RequestFieldKey.TIME_ZONE,
4747
RequestFieldKey.APP_VERSION,
48+
RequestFieldKey.APP_VERSION,
4849
RequestFieldKey.PACKAGE_NAME,
4950
RequestFieldKey.SDK_VERSION,
5051
RequestFieldKey.ANALYTICS_USER_PROPERTIES
@@ -59,6 +60,7 @@ public final class RemoteConfigConstants {
5960
String PLATFORM_VERSION = "platformVersion";
6061
String TIME_ZONE = "timeZone";
6162
String APP_VERSION = "appVersion";
63+
String APP_BUILD = "appBuild";
6264
String PACKAGE_NAME = "packageName";
6365
String SDK_VERSION = "sdkVersion";
6466
String ANALYTICS_USER_PROPERTIES = "analyticsUserProperties";

firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigFetchHttpClient.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.ANALYTICS_USER_PROPERTIES;
2020
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.APP_ID;
2121
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.APP_VERSION;
22+
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.APP_BUILD;
2223
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.COUNTRY_CODE;
2324
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.INSTANCE_ID;
2425
import static com.google.firebase.remoteconfig.RemoteConfigConstants.RequestFieldKey.INSTANCE_ID_TOKEN;
@@ -41,6 +42,7 @@
4142
import android.util.Log;
4243
import androidx.annotation.Keep;
4344
import androidx.annotation.VisibleForTesting;
45+
import androidx.core.content.pm.PackageInfoCompat;
4446
import com.google.android.gms.common.util.AndroidUtilsLight;
4547
import com.google.android.gms.common.util.Hex;
4648
import com.google.firebase.remoteconfig.BuildConfig;
@@ -322,9 +324,10 @@ private JSONObject createFetchRequestBody(
322324
context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
323325
if (packageInfo != null) {
324326
requestBodyMap.put(APP_VERSION, packageInfo.versionName);
327+
requestBodyMap.put(APP_BUILD, PackageInfoCompat.getLongVersionCode(packageInfo));
325328
}
326329
} catch (NameNotFoundException e) {
327-
// Leave app version blank if package cannot be found.
330+
// Leave app version and build number blank if package cannot be found.
328331
}
329332

330333
requestBodyMap.put(PACKAGE_NAME, context.getPackageName());

0 commit comments

Comments
 (0)