diff --git a/android/src/main/java/com/google/android/react/navsdk/Package.java b/android/src/main/java/com/google/android/react/navsdk/Package.java index 2b72a4c..9a4c1f5 100644 --- a/android/src/main/java/com/google/android/react/navsdk/Package.java +++ b/android/src/main/java/com/google/android/react/navsdk/Package.java @@ -20,6 +20,7 @@ import com.facebook.react.module.model.ReactModuleInfo; import com.facebook.react.module.model.ReactModuleInfoProvider; import com.facebook.react.uimanager.ViewManager; +import com.google.android.libraries.navigation.NavigationApi; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -28,6 +29,10 @@ @DoNotStrip public class Package extends BaseReactPackage { + static { + NavigationApi.addInternalUsageAttributionId(SdkVersion.ATTRIBUTION_ID); + } + @Override public List createViewManagers(ReactApplicationContext reactContext) { List viewManagers = new ArrayList<>(); diff --git a/android/src/main/java/com/google/android/react/navsdk/SdkVersion.java b/android/src/main/java/com/google/android/react/navsdk/SdkVersion.java new file mode 100644 index 0000000..aecfce3 --- /dev/null +++ b/android/src/main/java/com/google/android/react/navsdk/SdkVersion.java @@ -0,0 +1,26 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.react.navsdk; + +/** SDK version constants for internal usage attribution. */ +public final class SdkVersion { + public static final String VERSION = "0.15.1"; // {x-release-please-version} + + public static final String ATTRIBUTION_ID = "gmp_git_reactnativenavigationsdk_v" + VERSION; + + private SdkVersion() {} +} diff --git a/ios/react-native-navigation-sdk/NavModule.mm b/ios/react-native-navigation-sdk/NavModule.mm index 7ce3489..d4775c2 100644 --- a/ios/react-native-navigation-sdk/NavModule.mm +++ b/ios/react-native-navigation-sdk/NavModule.mm @@ -15,9 +15,11 @@ */ #import "NavModule.h" +#import #import "NavAutoModule.h" #import "NavViewModule.h" #import "ObjectTranslationUtil.h" +#import "SdkVersion.h" using namespace JS::NativeNavModule; @@ -50,6 +52,9 @@ + (id)allocWithZone:(NSZone *)zone { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedInstance = [super allocWithZone:zone]; + NSString *attributionId = + [NSString stringWithFormat:@"gmp_git_reactnativenavigationsdk_v%@", kRNNavSdkVersion]; + [GMSServices addInternalUsageAttributionID:attributionId]; }); return sharedInstance; } diff --git a/ios/react-native-navigation-sdk/SdkVersion.h b/ios/react-native-navigation-sdk/SdkVersion.h new file mode 100644 index 0000000..2b9c216 --- /dev/null +++ b/ios/react-native-navigation-sdk/SdkVersion.h @@ -0,0 +1,19 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +static NSString *const kRNNavSdkVersion = @"0.15.1"; // x-release-please-version diff --git a/release-please-config.json b/release-please-config.json index 4751b22..6c77155 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -8,7 +8,11 @@ "packages": { ".": { "package-name": "@googlemaps/react-native-navigation-sdk", - "changelog-path": "CHANGELOG.md" + "changelog-path": "CHANGELOG.md", + "extra-files": [ + "android/src/main/java/com/google/android/react/navsdk/SdkVersion.java", + "ios/react-native-navigation-sdk/SdkVersion.h" + ] } } }