Code Monkey home page Code Monkey logo

Comments (15)

tolu360 avatar tolu360 commented on August 12, 2024 1

Hi @she-dev, just change the line import { RNGooglePlaces } from 'react-native-google-places' to import RNGooglePlaces from 'react-native-google-places' and it should work just fine.

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024 1

Apparently it started to work correctly. Now I can type and the search suggests places.
What I did:

  • Put <meta-data> tag with API key right after opening <application> tag on AndroidManifest.xml, before <activity> tags.
  • Used the key named as Server key (auto created by Google Service). Restricted it to Android Apps and added configuration for my app and used it. I had created many keys and none appeared to work, so I decided to use that one. Not sure if I should reserve this "server key". It was suggested to me after clicking Create credentials -> Help me choose -> Google Places API for Android -> Which credentials do I need?
  • Made sure to go through the same step above (Create credentials -> ...) for the Google Maps Android API. It asked me if I wanted to enable it. The first time I clicked nothing changed. Then when I used the server key I saw it working.

Do you think it's bad to use the server key in this way?
Thanks for joining me in this saga :)

from react-native-google-places.

tolu360 avatar tolu360 commented on August 12, 2024 1

Hi @she-dev, glad you finally got it to work perfectly! Using the Help me choose option under Create credentials look totally fine to me, once the key has been created, you can stack on other permissions you may want the key to have. I have 2 keys, one restricted to Android apps and the other to iOS apps. I just add bundle identifiers and app IDs to these keys as needed, to support new apps I create.

Cheers!

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

@tolu360 Thanks, that stopped the error 👍
The thing now is that nothing happens when I click it.
I'll unlink it and reinstall everything.

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

@tolu360 It works perfectly on iOS simulator now but on Android I get this message:
Google Play Services is not available
Any ideas?

from react-native-google-places.

tolu360 avatar tolu360 commented on August 12, 2024

Do you have your API key set up in AndroidManifest.xml ?

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

And are you running in an Android emulator with Google APIs? See below:

screen shot 2016-12-14 at 8 13 34 pm

Likewise, to make this work on the emulator, you need to have Google Play services installed via the Android SDK Manager:

screen shot 2016-12-14 at 8 16 14 pm

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

API key shortened for the screenshot

I was using the one without Google API, then created a new device and ran on it.

Packages on Android SDK Manager are installed and updated.

from react-native-google-places.

tolu360 avatar tolu360 commented on August 12, 2024

Hi @she-dev, are you still getting the error after taking those steps?

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

Now it opens but when I start typing it closes the search and returns to the map.
And as you can see, it doesn't suggest nearby places.
Imgur

Then if I just leave the marker where it is, as there are no suggestions, I didn't select a place but SELECT this location is grayed out.
Imgur

from react-native-google-places.

tolu360 avatar tolu360 commented on August 12, 2024

You may need to look in the android monitor on Android studio for the stack-trace when that happens - an error may be getting logged. You may also just input a custom lat and lng coordinates into the emulator so the picker can instantiate at your custom position On a physical device, the picker would always launch at your current coordinates.

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

The weird thing is that I don't see any errors on the browser remote debugger.
I'll try to run it on Android 7.1 like you did and double-check the setup to see if I missed something.
Thanks for your help!

Current state:

from react-native-google-places.

tolu360 avatar tolu360 commented on August 12, 2024

You are welcome. Another debugging you can employ is run adb logcat to log the stack-trace to your terminal while the app is running and try to filter to entries containing 'RNGooglePlaces` - see if anything shows up. From your screencast, it's not acting as expected yet.

I know you've probably done this already but double-check that your API key has permissions for Places and Maps. Cheers!

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

Yesterday I had trouble selecting places again and then I remembered I had used the release certificate fingerprint to generate the SHA-1 fingerprint... and I'm not sure if I had previously done a release build, ha!
So I went back to the docs and repeated the process using the debug certificate and then restricted the API key using the new SHA-1 fingerprint.

Only use this certificate with apps that you're testing. Do not attempt to publish an app that's signed with a debug certificate.

As noted you may need to do this again with the release certificate when publishing the app.

Just a tip in case anyone has problems with this.

from react-native-google-places.

tolu360 avatar tolu360 commented on August 12, 2024

Thank you for the insights @she-dev, I should probably find somewhere to include this in the README rather than assume it is somewhat implied.

from react-native-google-places.

heloa-net avatar heloa-net commented on August 12, 2024

Thank you for developing this :)
It's complicated because it really is implied as it's just indirectly related to your project.
But the problem is that the steps are not as clear as they should be and there are little details that can lead to problems.
I went through the default Android setup and never saw most of the stuff you helped me with.

from react-native-google-places.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.