Skip to content

Commit 546649f

Browse files
committed
feat: internal usage attribution ID
1 parent 22075ce commit 546649f

5 files changed

Lines changed: 60 additions & 1 deletion

File tree

android/src/main/java/com/google/android/react/navsdk/Package.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.facebook.react.module.model.ReactModuleInfo;
2121
import com.facebook.react.module.model.ReactModuleInfoProvider;
2222
import com.facebook.react.uimanager.ViewManager;
23+
import com.google.android.libraries.navigation.NavigationApi;
2324
import java.util.ArrayList;
2425
import java.util.HashMap;
2526
import java.util.List;
@@ -28,6 +29,10 @@
2829
@DoNotStrip
2930
public class Package extends BaseReactPackage {
3031

32+
static {
33+
NavigationApi.addInternalUsageAttributionId(SdkVersion.ATTRIBUTION_ID);
34+
}
35+
3136
@Override
3237
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
3338
List<ViewManager> viewManagers = new ArrayList<>();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.android.react.navsdk;
18+
19+
/** SDK version constants for internal usage attribution. */
20+
public final class SdkVersion {
21+
public static final String VERSION = "0.15.1"; // {x-release-please-version}
22+
23+
public static final String ATTRIBUTION_ID = "gmp_git_reactnativenavigationsdk_v" + VERSION;
24+
25+
private SdkVersion() {}
26+
}

ios/react-native-navigation-sdk/NavModule.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
*/
1616

1717
#import "NavModule.h"
18+
#import <GoogleMaps/GoogleMaps.h>
1819
#import "NavAutoModule.h"
1920
#import "NavViewModule.h"
2021
#import "ObjectTranslationUtil.h"
22+
#import "SdkVersion.h"
2123

2224
using namespace JS::NativeNavModule;
2325

@@ -50,6 +52,9 @@ + (id)allocWithZone:(NSZone *)zone {
5052
static dispatch_once_t onceToken;
5153
dispatch_once(&onceToken, ^{
5254
sharedInstance = [super allocWithZone:zone];
55+
NSString *attributionId =
56+
[NSString stringWithFormat:@"gmp_git_reactnativenavigationsdk_v%@", kRNNavSdkVersion];
57+
[GMSServices addInternalUsageAttributionID:attributionId];
5358
});
5459
return sharedInstance;
5560
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#import <Foundation/Foundation.h>
18+
19+
static NSString *const kRNNavSdkVersion = @"0.15.1"; // x-release-please-version

release-please-config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
"packages": {
99
".": {
1010
"package-name": "@googlemaps/react-native-navigation-sdk",
11-
"changelog-path": "CHANGELOG.md"
11+
"changelog-path": "CHANGELOG.md",
12+
"extra-files": [
13+
"android/src/main/java/com/google/android/react/navsdk/SdkVersion.java",
14+
"ios/react-native-navigation-sdk/SdkVersion.h"
15+
]
1216
}
1317
}
1418
}

0 commit comments

Comments
 (0)