I’m having trouble locating nearby places with the Google API. I’ve set up my project with a browser key for API calls and an Android API key in the manifest. But when I run a search, I get no results.
hey flyingeagle, looks like ur location params are set to 0.0,0.0 in the API call. thats probably why ur getting no results. try using actual coordinates for the area u wanna search in. also double check if ur api key is correct and has the necessary permissions enabled. hope this helps!
Upon examining your API request, I noticed the location parameter is set to 0.0,0.0. This coordinate represents a point in the Gulf of Guinea, off the coast of Africa, where you’re unlikely to find restaurants. To resolve this, ensure you’re passing valid latitude and longitude values for the area you wish to search.
Additionally, verify that your API key has the Places API enabled in your Google Cloud Console. Sometimes, even with a valid key, if the specific API isn’t activated, you’ll receive no results.
Lastly, consider adjusting your radius if necessary. 5000 meters is reasonable, but depending on the density of the area you’re searching, you might want to increase or decrease this value.
I’ve run into similar issues before, and it can be frustrating. From what I see, the main problem is your location coordinates (0.0, 0.0). That’s basically the middle of nowhere in the ocean!
To fix this, you need to get the user’s actual location first. Use the device’s GPS or network provider to fetch real coordinates. Once you have those, plug them into your API call.
Also, make sure you’re handling permissions correctly. Android requires explicit user consent for location access. If you’re not getting that, the coordinates default to 0,0.
One last tip: the ‘sensor’ parameter is deprecated. You can safely remove it from your request. Keep at it, and don’t hesitate to reach out if you hit any more snags!