diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 1d3821b..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/android/build.gradle b/android/build.gradle index 9451d42..92420bc 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -62,6 +62,7 @@ repositories { dependencies { implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:7.0.0' + implementation 'androidx.startup:startup-runtime:1.2.0' implementation 'com.facebook.react:react-native:+' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' api 'com.google.guava:guava:31.0.1-android' diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index efbaa22..365a671 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -15,7 +15,17 @@ limitations under the License. --> + xmlns:tools="http://schemas.android.com/tools" + package="com.google.android.react.driversdk"> + + + - + \ No newline at end of file diff --git a/android/src/main/java/com/google/android/react/driversdk/DriverSdkInitializer.java b/android/src/main/java/com/google/android/react/driversdk/DriverSdkInitializer.java new file mode 100644 index 0000000..ed79f6a --- /dev/null +++ b/android/src/main/java/com/google/android/react/driversdk/DriverSdkInitializer.java @@ -0,0 +1,42 @@ +/* + * 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.driversdk; + +import android.content.Context; +import androidx.annotation.NonNull; +import androidx.startup.Initializer; +import com.google.android.gms.maps.MapsApiSettings; +import java.util.Collections; +import java.util.List; + +/** Registers the Driver SDK internal usage attribution ID at application startup. */ +public final class DriverSdkInitializer implements Initializer { + + @NonNull + @Override + public Void create(@NonNull Context context) { + MapsApiSettings.addInternalUsageAttributionId( + context.getApplicationContext(), SdkVersion.ATTRIBUTION_ID); + return null; + } + + @NonNull + @Override + public List>> dependencies() { + return Collections.emptyList(); + } +} diff --git a/android/src/main/java/com/google/android/react/driversdk/SdkVersion.java b/android/src/main/java/com/google/android/react/driversdk/SdkVersion.java new file mode 100644 index 0000000..0bab386 --- /dev/null +++ b/android/src/main/java/com/google/android/react/driversdk/SdkVersion.java @@ -0,0 +1,27 @@ +/* + * 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.driversdk; + +/** SDK version constants for internal usage attribution. */ +public final class SdkVersion { + public static final String VERSION = "0.4.0"; // {x-release-please-version} + + public static final String ATTRIBUTION_ID = + "gmp_git_reactnativedriversdk_v" + VERSION + "_android"; + + private SdkVersion() {} +} diff --git a/example/.DS_Store b/example/.DS_Store deleted file mode 100644 index ab35450..0000000 Binary files a/example/.DS_Store and /dev/null differ diff --git a/example/LMFS/.DS_Store b/example/LMFS/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/example/LMFS/.DS_Store and /dev/null differ diff --git a/example/ODRD/.DS_Store b/example/ODRD/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/example/ODRD/.DS_Store and /dev/null differ diff --git a/ios/.DS_Store b/ios/.DS_Store deleted file mode 100644 index cc5a95c..0000000 Binary files a/ios/.DS_Store and /dev/null differ diff --git a/ios/RNDriverSdkAttribution.m b/ios/RNDriverSdkAttribution.m new file mode 100644 index 0000000..a22cc1b --- /dev/null +++ b/ios/RNDriverSdkAttribution.m @@ -0,0 +1,29 @@ +// 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 +#import "SdkVersion.h" + +@interface RNDriverSdkAttribution : NSObject +@end + +@implementation RNDriverSdkAttribution + ++ (void)load { + NSString *attributionId = + [NSString stringWithFormat:@"gmp_git_reactnativedriversdk_v%@_ios", kRNDriverSdkVersion]; + [GMSServices addInternalUsageAttributionID:attributionId]; +} + +@end diff --git a/ios/SdkVersion.h b/ios/SdkVersion.h new file mode 100644 index 0000000..95c0966 --- /dev/null +++ b/ios/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 kRNDriverSdkVersion = @"0.4.0"; // x-release-please-version diff --git a/release-please-config.json b/release-please-config.json index 8d74708..20da18b 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -8,7 +8,11 @@ "packages": { ".": { "package-name": "@googlemaps/react-native-driver-sdk", - "changelog-path": "CHANGELOG.md" + "changelog-path": "CHANGELOG.md", + "extra-files": [ + "android/src/main/java/com/google/android/react/driversdk/SdkVersion.java", + "ios/SdkVersion.h" + ] } } }