質問

I have exactly the same problem as Autocomplete textview google places api

But the fixes suggested to him don't fix the problem with my case. I uses the exact same code. But it does not work.

tanks for the api tip

i debuged the problem and saw i am getting a respond of zero_results

Any suggestion?

                String input = "";

        try {
            input = "input=" + URLEncoder.encode(place[0], "utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }

        // place type to be searched
        String types = "types=geocode";

        // Sensor enabled
        String sensor = "sensor=false";

        // Building the parameters to the web service
        String parameters = input + "&" + types + "&" + sensor + "&" + key;

        // Output format
        String output = "json";

        // Building the url to the web service
        String url =         "https://maps.googleapis.com/maps/api/place/autocomplete/json?input="
                + output + "?" + parameters;
役に立ちましたか?

解決

You problem is you API key configuration. Make sure you are creating an API key in "Public API access" section.

Public API access

  • You can find how to get the finger print in this post:

How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?

  • Then in google console register you API key. Remember add to the final you name package declared in your Android Manifest.

  • finger print example:

F7:DB:FF:EB:6E:AD:C1:D6:84:05:1D:BA:F7:94:0D:E4:1F:2E:3C:8C;cl.hcarrasco.tm

  • Enable Google Places API: Remember too do this:

enter image description here

I hope this can help you.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top