问题
Hello I am facing the Google Place API Error
Status{statusCode=PLACES_API_ACCESS_NOT_CONFIGURED, resolution=null}
According to Google new policy "Deprecation notice: Google Play Services version of the Places SDK for Android"
Notice: The Google Play Services version of the Places SDK for Android (in Google Play Services 16.0.0) is deprecated as of January 29, 2019, and will be turned off on July 29, 2019. A new version of the Places SDK for Android is now available. We recommend updating to the new version as soon as possible. For details, see the migration guide. Google Place Autocomplete
My Android Code
<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: Starting input: 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.googleautocompleteplacesandroid I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus 2019-03-15 11:56:53.819 17418-17418/com.manish.velmurugan.googleautocompleteplacesandroid D/InputTransport: Input channel constructed: 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: Input channel constructed: fd=70 2019-03-15 11:56:53.831 17418-17418/com.manish.velmurugan.googleautocompleteplacesandroid D/ViewRootImpl@eace7f4[Toast]: setView = android.widget.LinearLayout{9034b1d V.E...... ......I. 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]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[115,1980][1324,2304] result=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) returns 0x3000, [1209x324]-format: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) or=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) or=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: Input channel destroyed: fd=70
>
what is the alternative to achive this task "Place Autocomplete"
This question is not duplicate Stackoverflow question becouse this question is asked 3 year before for now.
回答1:
Ill solve the problem regarding google place API, i am created the GitHub Public Repository to simulate the the Google Place API
GitHub Repository
来源:https://stackoverflow.com/questions/55176965/android-google-place-api-error-statusstatuscode-places-api-access-not-configure