Skip to content

Conversation

@aednlaxer
Copy link
Collaborator

@aednlaxer aednlaxer commented May 9, 2025

First draft of attributionId call:

  • Call method to send attribution Ids (Android, iOS but not web)
  • Use version_check.yaml and a set of new tools to check if package's version matches the version in the native layer (java (Android), .h (iOS), .dart (web))
  • Had to bump min iOS version from 14.0 to 15.0 in order to use a newer GoogleMaps pod that has attribution Id function available

[GMSServices provideAPIKey:mapsApiKey];

NSString *attributionId = [NSString stringWithFormat:@"gmp_flutter_googlemapsflutter_v%sandroid", PREFIX_PLUGIN_VERSION];
[GMSServices addInternalUsageAttributionID:attributionId];
Copy link

@jokerttu jokerttu May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example app is not right place to do this. We need to do this somehow on the package code.
As devs can easily left this out.
Maybe we need to do this on first map view initialization (if not done yet)?
Or if it is possible to detect that key is given for GMSServices somehow.
Let's ask Caio / and their team what they think of that.
This means that applications do not report the package usage, unless map is shown on the app. (which sounds right?)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be done here:
https://github.com/CodemateLtd/packages/blob/main/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.m#L12

Please check if this is called always after AppDelegate is completed; I suppose it is, but let's be sure. Then we can be sure the provideApiKey is always called before running the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the code to use selector for this call but it seems to be called in this order:

  1. FLTGoogleMapPlugin
  2. AppDelegate

Is there a problem with this? The reference doesn't say it should be called after map API key is set

@aednlaxer
Copy link
Collaborator Author

Will create a new clean PR

@aednlaxer aednlaxer closed this May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants