iosswiftinstantiationgoogle-maps-sdk-ios

Question about Google Maps SDK billing in relation to GMSPanoramaView instantiation


I'm trying to figure out the costs of loading and displaying PanoramaViews in an iOS app using Google Maps SDK.

By the official documentation, StreetView is charged $14 per 1000 instantiations up to 100k, and $11.2 above it (with volume discounts over 500k). Here the source.

In particular, it states:

An instantiation of a panorama object occurs on iOS with the GMSPanoramaView object.

To me, both because english is not my native language and the concept I know of instantiation, is not really clear what this means. The point is that the official documentation offers a couple methods (see here for one) to move the location and change the panorama displayed by the GMSPanoramaView object after it is created. The only thing that the documentation states clearly is that moving to nearby panoramas by double tapping or tapping the navigation arrows is not subject to charge.

So about billing, I'm trying to understand which of these two applies:

  1. a fixed cost is charged for every time a new GMSPanoramaView is created (e.g. let panoView = GMSPanoramaView(frame: .zero)) , and, once created, moving the panorama to a different region and displaying it by calling the moveNearCoordinate() method is free of charge (basically it is charged 0.014$ for each app launch, if handled properly);

  2. the fixed cost also applies to the moveNearCoordinate() method - so, each time the panoramaID property of the GMSPanoramaView is changed.

I was almost sure that the 1. case was true when a guy told me that in his app (which uses the Android SDK) he was also billed for each time the panorama was moved.

Of course if I'm asking this is because I cannot still test it by myself. Can anyone shine a light about how the billing works?

EDIT: I've found out that Google offers some free credits and I quickly set up a project to test it.

The project is built as follows:

Apparently Google Developer Console reports the requests each 4-6 hours, so I was able to do three tests. I've tried to launch the app on my iPhone, load all 12 of the panos (+ the initial one) without quitting the app, then force quit the app for each test. Here the result for each test:

  1. 4 requests were billed;
  2. 2 requests billed;
  3. 2 requests billed, I lost the connection once during the process.

This is a bit confusing, as I expected either 1 or 13 requests billed. Either something's wrong with the Maps SDK, my GMSPanoramaView object was somehow deallocated and reinstantiated (this unlikely, since a panorama is always displayed on screen) or there's another issue I can't think of.

Again, if someone can clarify what's happening I'm grateful. Also, tips to minimize the instantiations/the costs are super appreciated.


Solution

  • I was able to reduce the number of charged requests to 1 per app launch by declaring the GMSPanoramaView object as static.