Google Places for Android API key does not work on app from Play Store

前端 未结 5 2195
感情败类
感情败类 2021-01-11 10:38

I recently launched an Android app which makes use of the Google Places autocomplete widget/API. As part of the configuration for this, I added the API key to my Android\'s

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-11 11:16

    you can try this different solutions, maybe it's work for you

    Solution - 1

    try to save log in text file for every event like onError, OnPlaceSelected, onConnectionFailed, OnConnection and then upload your app to playstore now run the app and check the log file i am sure if it's not working then i should display some problem in log file

    Solution - 2

    Release APK and debug APK has different SHA1 and different API keys for google services. Both of them must be added to console

    Solution - 3

    or now you can use intent for autocomplete feature

    int PLACE_AUTOCOMPLETE_REQUEST_CODE = 1;
    ...
    try {
    Intent intent =
            new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
                    .build(this);
    startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
    } catch (GooglePlayServicesRepairableException e) {
    // TODO: Handle the error.
    } catch (GooglePlayServicesNotAvailableException e) {
    // TODO: Handle the error.
    } 
    

    For More Detail look at here - https://developers.google.com/places/android-sdk/autocompleteand read carefully

    Solution - 4 at last try to display place name as Toast with custom latitude and longitude without autocomplete to check whether we are receiving data from server or not

    Hope this will be helpful for you

提交回复
热议问题