-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat!: update to maps 20.0.0 #1644
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cdb28ce
feat: update to maps 20.0.0 and add usage attribution
dkhawk 876a8f9
docs: add internal usage attribution disable instructions and secrets…
dkhawk e91cc59
style: fix long kdoc lines in AttributionIdInitializer
dkhawk 0d2bff0
test: add unit test for AttributionIdInitializer
dkhawk 1c05fbc
docs: update copyright years to 2026
dkhawk 50081cd
build: update androidx.test:core to 1.7.0
dkhawk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
library/src/main/java/com/google/maps/android/utils/attribution/AttributionIdInitializer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * 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 | ||
| * | ||
| * http://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.maps.android.utils.attribution | ||
|
|
||
| import android.content.Context | ||
| import androidx.startup.Initializer | ||
| import com.google.android.gms.maps.MapsApiSettings | ||
| import com.google.maps.android.utils.meta.AttributionId | ||
|
|
||
| /** | ||
| * Adds a usage attribution ID to the initializer, which helps Google understand which libraries | ||
| * and samples are helpful to developers, such as usage of this library. | ||
| * To opt out of sending the usage attribution ID, please remove this initializer from your manifest. | ||
| */ | ||
| internal class AttributionIdInitializer : Initializer<Unit> { | ||
| override fun create(context: Context) { | ||
| // See [AttributionIdInitializer] | ||
| MapsApiSettings.addInternalUsageAttributionId( | ||
| /* context = */ context, | ||
| /* internalUsageAttributionId = */ AttributionId.VALUE | ||
| ) | ||
| } | ||
|
|
||
| override fun dependencies(): List<Class<out Initializer<*>>> { | ||
| return emptyList() | ||
| } | ||
| } |
63 changes: 63 additions & 0 deletions
63
...y/src/test/java/com/google/maps/android/utils/attribution/AttributionIdInitializerTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * 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 | ||
| * | ||
| * http://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.maps.android.utils.attribution | ||
|
|
||
| import android.content.Context | ||
| import androidx.test.core.app.ApplicationProvider | ||
| import com.google.android.gms.maps.MapsApiSettings | ||
| import com.google.maps.android.utils.meta.AttributionId | ||
| import io.mockk.every | ||
| import io.mockk.just | ||
| import io.mockk.mockkStatic | ||
| import io.mockk.runs | ||
| import io.mockk.unmockkStatic | ||
| import io.mockk.verify | ||
| import org.junit.After | ||
| import org.junit.Before | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
| import org.robolectric.RobolectricTestRunner | ||
|
|
||
| @RunWith(RobolectricTestRunner::class) | ||
| class AttributionIdInitializerTest { | ||
|
|
||
| @Before | ||
| fun setUp() { | ||
| mockkStatic(MapsApiSettings::class) | ||
| every { MapsApiSettings.addInternalUsageAttributionId(any(), any()) } just runs | ||
| } | ||
|
|
||
| @After | ||
| fun tearDown() { | ||
| unmockkStatic(MapsApiSettings::class) | ||
| } | ||
|
|
||
| @Test | ||
| fun `create adds internal usage attribution id`() { | ||
| val context = ApplicationProvider.getApplicationContext<Context>() | ||
| val initializer = AttributionIdInitializer() | ||
|
|
||
| initializer.create(context) | ||
|
|
||
| verify { | ||
| MapsApiSettings.addInternalUsageAttributionId( | ||
| context, | ||
| AttributionId.VALUE | ||
| ) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / Android Lint
Obsolete Android Gradle Plugin Version Warning