Google Places API Android resultCallback not firing

前端 未结 2 1211
独厮守ぢ
独厮守ぢ 2021-01-23 08:18

I\'m using the Google Places API for Android and I can\'t seem to get a resultCallback from a PendingResult to fire. Here\'s my code (essentially ident

相关标签:
2条回答
  • 2021-01-23 08:44

    For reference, to anyone who visits this question, make sure you do all 3 steps below:

    Add your API key to your app manifest

    <application>
    ...
     <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_API_KEY"/>
    </application>
    

    Then include in your manifest as @Alex Baker suggested

    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    

    And also enable Google Places API for Android. Google Places API is a different API and your calls will fail with Places AutoComplete status 9001

    0 讨论(0)
  • 2021-01-23 08:45

    I had the same issue because I was missing the permission that allows the API to access Google web-based services

    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    
    0 讨论(0)
提交回复
热议问题