小编Ahm*_*sam的帖子

自动完成时发生自动完成错误:OVER_QUERY_LIMIT

当我尝试在“地点自动完成”中搜索时,出现“无法加载搜索结果” 并且日志显示

“自动填充时出错:OVER_QUERY_LIMIT”

我已启用https://console.cloud.google.com/, 并且API密钥运行良好。

在此处输入图片说明

Java代码

    String apiKey = "MY API KEY";
    private RadioGroup mRadioGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_costumer_map);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);

        Places.initialize(getApplicationContext(), apiKey);

        PlacesClient placesClient = Places.createClient(this);
          // Initialize the AutocompleteSupportFragment.
        AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment)
                getSupportFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);

        // Specify the types of place data to return.
        autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));

        // Set up a PlaceSelectionListener to handle the response. …
Run Code Online (Sandbox Code Playgroud)

android google-maps google-places-api google-places

7
推荐指数
1
解决办法
6024
查看次数