Comments (15)
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.
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.
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.
@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.
@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.
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:
Likewise, to make this work on the emulator, you need to have Google Play services
installed via the Android SDK Manager
:
from react-native-google-places.
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.
Hi @she-dev, are you still getting the error after taking those steps?
from react-native-google-places.
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.
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.
from react-native-google-places.
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.
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!
from react-native-google-places.
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.
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.
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.
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)
- Important places.. HOT 2
- Possible option to process search when user is done typing instead of autocomplete?
- Android - This IP, site or mobile application is not authorized to use this API key. Request received from IP address **** with empty referer HOT 13
- Apple Mach-O linker Error
- over limit query error HOT 1
- Start search only when user clicks on the enter or return key
- To get location using postal code
- Updating GoogleMaps to 3.5.0 HOT 10
- [IOS] priceLevel is returned even if not selected in placeFields - possible billing concern HOT 2
- [iOS] Keyboard don't dismiss after selecting place
- Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo(com.google.android.libraries.places.widget.AutocompleteActivity) HOT 1
- [QUESTION] Is this repo being maintained? HOT 3
- by using RNGooglePlaces.getCurrentPlace() getting wrong current locations in Ios. same code working fine in android
- Place Details Viewport changes starting with Places SDK for iOS v5.0
- Both ACCESS_WIFI_STATE & ACCESS_FINE_LOCATION permissions are required (Android) HOT 1
- Installing with react-native-maps HOT 1
- 8: Location unavailable error when trying to get user current location
- (Android Play Store) Leaked GCP API Keys: Your app contains exposed Google Cloud Platform (GCP) API keys HOT 3
- android build issue -> Could not find com.android.volley:volley:1.1.1 HOT 14
- patch-package react-native-google-places+3.1.2.patch HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-google-places.