Android Place Picker closes immediately after launch
Francois Wouts' solutions helped answer this. Thank you Francois...
I searched the logs with keyword 'Places' and found that Places API was indeed throwing an exception. It expected the com.google.android.geo.API_KEY
within the <application>
tags in the Manifest.xml.
I had changed to com.google.android.geo.API_KEY
in the <activity>
tag and not the one in the <application>
tag.
Now changed to com.google.android.geo.API_KEY
and removed the same lines from <activity>
tag, and got it working. Feel like an idiot for not working this out by myself..
The meta-data tag should read
android:name="com.google.android.geo.API_KEY"
It should be within the<application>
tag in the Manifest.
Have you double checked that your API key is associated with your application (package name and SHA-1 fingerprint of your app's certificate) in the Developer Console?
You can find instructions at Signup and API Keys. Make sure to set it up for both your debug and your release certificates.
I hope that helps!
I was having the same issue. Make sure you enable Google Places API for Android and not just Places API in the Developer Console. "Places API for Android" will not show up under APIs & Auth/APIs because it isn’t a popular API (yet). You will have to search for it using the API search box.
In manifest file com.google.android.geo.api_key and com.google.android.maps.v2.API_KEY shouldnot be same.
go to https://console.developers.google.com/project
login and follow these steps to get key for placepicker places.
create or choose existing > use google apis > Google Places API for Android > enable > credentials in left menu > add credentials > api key > android key > create > copy key.
paste your key at manifest "com.google.android.geo.api_key"
Note : there is a limit of 1000 requests per day for google places api. after you have to pay money. Better to avoid PlacePicker.