您好,我遇到Google Place API错误
Status{statusCode=PLACES_API_ACCESS_NOT_CONFIGURED, resolution=null}
根据Google新政策“弃用通知:适用于Android的Places SDK的Google Play服务版本”
注意:Android版Places SDK的Google Play服务版本(在Google Play服务16.0.0中)自2019年1月29日起已弃用,并将于2019年7月29日关闭。 Android的Places SDK现在可用。我们建议尽快更新到新版本。有关详细信息,请参阅迁移指南。 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状态{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 =空值 2019-03-15 11:56:53.815 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid 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)返回0x [1209x324]-格式:1 2019-03-15 11:56:53.878 17418-17418 / com.manish.velmurugan.googleautocompleteplacesandroid 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
>
完成此任务“放置自动完成”的替代方法是什么
此问题不是重复的Stackoverflow question,因为此问题是3年之前提出的。
答案 0 :(得分:1)
我将解决有关Google Place API的问题,我创建了GitHub Public Repository以模拟Google Place API