Skip to content
Advertisement

android – Google places opens the map on closes after 1 sec

Im creating an intent to an activity by clicking on a button which should open google places, but it closes again really fast and says no location selected, and returns to the main activity, and then nothing happens if i click again.

My api should be fine, I have checked that it’s the correct SHA1-fingerprint thats connected to the api key.

The result code is 2

It worked earlier in the activity before this one, but I needed it to open when i click on a button instead, and now when I try to open this new activity as an intent it wont work.

JavaScript

}

This is from the intent which create the new intent to maps

JavaScript

Advertisement

Answer

I think its happening because of you are using old method of getPlace

try to swap the arguments, by changing it from:

JavaScript

to

JavaScript

Update #2

Enable Google places API in the developer console and add these lines to AndroidManifest

JavaScript

Update #3

after some search, it looks like there is others having same issue. Look at these links:

https://github.com/zhangtaii/react-native-google-place-picker/issues/21

https://stackoverflow.com/a/32751164/

https://github.com/googlesamples/android-play-places/issues/13

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement