Place Picker automatically closing

前端 未结 1 831
不思量自难忘°
不思量自难忘° 2021-01-24 12:23

I\'m making a simple place picker program in android and the problem is when I click on button the place picker opens and automatically closes after 2 - 3 seconds... please help

相关标签:
1条回答
  • 2021-01-24 12:47

    I ran your code and configuration, and saw the same behavior that you were seeing.

    After comparing your configuration to one that I had working, I realized that the issue is that in your AndroidManifest.xml, you need to change this:

    android:name="com.google.android.maps.v2.API_KEY"
    

    To this:

    android:name="com.google.android.geo.API_KEY"
    

    I went back and tested multiple times with both configurations just to make sure that this was what was causing your issue. Using the first configuration, the PlacePicker closes immediately every time.

    Using com.google.android.geo.API_KEY, it works perfectly every time.

    This is also what the documentation states you need to use for the Places API.

    Result of testing with your code, and the one modification needed to make it work:

    enter image description here

    After picking a Place:

    enter image description here

    0 讨论(0)
提交回复
热议问题