Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GMSAutocompleteViewController showing only 5 results

I integrated GMSAutocompleteViewController in my app.

let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
let filter = GMSAutocompleteFilter()
filter.type = .address
autocompleteController.autocompleteFilter = filter

// Display the autocomplete view controller.
present(autocompleteController, animated: true, completion: nil)    

This always shows only 5 results. Also, the behaviour seems to be a bit weird. At first when I write J in the search, 5 results are displayed. After writing some more text and removing those to again set the search text as J, I get - Can't load results. And then results are never displayed unless I relaunch my app.
I tried the same implementation in Android using AutocompleteSupportFragment and it works very well. I was earlier wondering after seeing Ravi's answer, and few others as well. But if enabling billing was the solution, why is it working fine in Android without enabling billing ?

like image 634
Nitish Avatar asked Apr 12 '19 04:04

Nitish


1 Answers

I am assuming that you have Google Places API enabled and as well you have no application restrictions under your Google Developer Console for that project. Said that there is a Google page about APIs and billing

  1. Android and iOS Places APIs might differ, and hence for some APIs you might need to enable billing:

    Some APIs allow free usage up to a courtesy usage limit, and in some cases this free limit is increased when you enable billing.

  2. Maybe in your Android App you are using an API linked to a project that has billing enabled and for your iOS App you are using an API linked to another project where billing is not enabled.

    Billing is enabled at the project level, not the API level. If you enable billing for a project, then every billable API in that project is billed, based on the project's usage. All usage in a project is billed using the payment method that you specify, and you can change to a different method at any time. You cannot selectively enable billing for some APIs but not others; when you enable billing for a project, it applies to all the APIs that you used within that project, even if the API is currently disabled.

Maybe something is related to the version of Places SDK you are using in your Android App Project and some of its inner functionality could affect if you are going to talk to their updated APIs version which requires Billing to be enabled or not. Check information stated in Migrating to the New Places SDK Client for this assumption.

Lastly, as stated from lots of documentations from Google in Places SDK for Android, Places SDK for iOS, Places API, they all have a red warning in the beginning of each article saying that in each project you should enable Billing. If all my before statements fails, it might mean that they are applying the rule of Billing and APIs functionality restriction in different batches of users/projects, and hence your android app project might have fall in a batch that still hasn't rolled out to force Billing option enabled.

like image 96
denis_lor Avatar answered Oct 12 '22 02:10

denis_lor