user12096117
user12096117

Reputation:

Google PlacePicker Closes After Launch with resultCode 2

After clicking on add location button, the Map app opens and immediately closes again.

The result code in the onActivityResult is 2.

Log Statement:

2020-05-31 08:18:41.451 17063-17063/com.example.shushme D/MainActivity: API Client Connection Successful!

2020-05-31 08:18:42.187 17063-17063/com.example.shushme D/MainActivity: startActivityForResult i: Intent { act=com.google.android.gms.location.places.ui.PICK_PLACE pkg=com.google.android.gms (has extras) }

2020-05-31 08:18:42.208 17063-17063/com.example.shushme D/MainActivity: startActivityForResult called

2020-05-31 08:18:42.786 17063-17063/com.example.shushme D/MainActivity: onActivityResult requestCode: 100 resultCode: 2 data: null

I changed my API key many times but still issue occurs. I developed the SHA-1 fingerprint and added in my developer console also. enter image description here

I have uploaded my code on github

GitHub Link: https://github.com/yashth/ShushMe

Please check my code and tell me what went wrong, I have already done all the steps mentioned in similar issues but still no luck.

Upvotes: 0

Views: 222

Answers (1)

smga08
smga08

Reputation: 624

Upon checking your code, it seems that you are still using the old Places SDK for Android com.google.android.gms:play-services-places. This version of Places SDK for Android has been turned off last July 29, 2019. There is a new version of the SDK com.google.android.libraries.places:places that is currently available and you need to migrate your implementation to the newer version to avoid issues.

Also, as per the documentation, Place Picker is no longer avaialble in the new version of Places SDK for Android. You need to use Place Autocomplete instead.

You can checkout sample implementation of the new Places SDK for Android here: https://github.com/googlemaps/android-places-demos

Hope this helps!

Upvotes: 0

Related Questions