Android Google Place API错误状态{statusCode = PLACES_API_ACCESS_NOT_CONFIGURED,resolution = null}

问题描述 投票:1回答:1

您好我正面临Google Place API错误

Status{statusCode=PLACES_API_ACCESS_NOT_CONFIGURED, resolution=null}

根据谷歌新政策“弃用通知:适用于Android的Places SDK的Google Play服务版”

注意:Google Play服务版的适用于Android的地方SDK(在Google Play Services 16.0.0中)自2019年1月29日起已被弃用,并将于2019年7月29日关闭。新版本的Places SDK for Android现已推出。我们建议您尽快更新到新版本。有关详细信息,请参阅迁移指南。 Google Place Autocomplete

我的Android代码

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

 placeAutocompleteFragment = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);

    AutocompleteFilter autocompleteFilter = new AutocompleteFilter.Builder().setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES).build();

    placeAutocompleteFragment.setFilter(autocompleteFilter);

    placeAutocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
        @Override
        public void onPlaceSelected(Place place) {
            Toast.makeText(getApplicationContext(),place.getName().toString(),Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onError(Status status) {
            System.out.println("apierror   "+status.toString());
            Toast.makeText(getApplicationContext(),status.toString(),Toast.LENGTH_SHORT).show();
        }
    });

logcat的

2019-03-15 11:56:53.778 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid I / System.out:apierror Status {statusCode = PLACES_API_ACCESS_NOT_CONFIGURED,resolution = null} 2019-03-15 11:56:53.814 17418- 17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ 1326f91 [MainActivity]:MSG_WINDOW_FOCUS_CHANGED 1 2019-03-15 11:56:53.814 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ 1326f91 [MainActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface = {isValid = true 543796078080} 2019-03-15 11:56:53.814 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / SEM_CLIP_SemClipboardManager:isCocktailBarDisplayed:false 2019-03-15 11: 56:53.815 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid V / InputMethodManager:开始输入:tba = android.view.inputmethod.EditorInfo@7b271e1 nm:com.manish.velmurugan.googleautocompleteplacesandroid ic = null 2019-03-15 11 :56:53.815 17418-17418 / com.manish.velmurugan.goo gleautocompleteplacesandroid I / InputMethodManager:[IMM] startInputInner - mService.startInputOrWindowGainedFocus 2019-03-15 11:56:53.819 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / InputTransport:输入通道构造:fd = 68 2019-03-15 11:56:53.825 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:ThreadedRenderer.create()translucent = true 2019-03-15 11:56:53.830 17418-17418 / com.manish .velmurugan.googleautocompleteplacesandroid D / InputTransport:输入通道构造:fd = 70 2019-03-15 11:56:53.831 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:setView = android.widget .LinearLayout {9034b1d VE ..... ......我。 0,0-0,0} touchMode = true 2019-03-15 11:56:53.841 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:dispatchAttachedToWindow 2019-03-15 11:56 :53.875 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:返回重新布局:oldFrame = [0,0] [0,0] newFrame = [115,1980] [1324,2304]结果= 0x27 surface = {isValid = true 543267962880} surfaceGenerationChanged = true 2019-03-15 11:56:53.875 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:mHardwareRenderer.initialize()mSurface = {isValid = true 543267962880} hwInitialized = true 2019-03-15 11:56:53.878 17418-17433 / com.manish.velmurugan.googleautocompleteplacesandroid D / mali_winsys:EGLint new_window_surface(egl_winsys_display *,void *,EGLSurface,EGLConfig,egl_winsys_surface ** ,egl_color_buffer_format *,EGLBoolean)返回0x3000,[1209x324] -format:1 2019-03-15 11:56:53.878 17418-17418 / com.manish.velmurugan.googleautocomplet eplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:MSG_RESIZED_REPORT:ci = Rect(0,0 - 0,0)vi = Rect(0,0 - 0,0)或= 1 2019-03-15 11:56:53.898 17418 -17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ 1326f91 [MainActivity]:MSG_RESIZED:ci = Rect(0,96 - 0,0)vi = Rect(0,96 - 0,0)或= 1 2019- 03-15 11:56:55.825 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:mHardwareRenderer.destroy()#4 2019-03-15 11:56:55.826 17418-17418 / com .manish.velmurugan.googleautocompleteplacesandroid D / ViewRootImpl @ eace7f4 [Toast]:dispatchDetachedFromWindow 2019-03-15 11:56:55.846 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid D / InputTransport:输入通道被破坏:fd = 70

>

什么是实现此任务的替代方法“放置自动完成”

这个问题不是重复的qazxsw poi,因为这个问题是3年前问的。

android google-places-api google-places placeautocompletefragment
1个回答
2
投票

我解决了谷歌地方API的问题,我创建了GitHub公共存储库来模拟Google Place API

Stackoverflow question

© www.soinside.com 2019 - 2024. All rights reserved.