0

I wanted to implement AutocompleteFragment (google places) but when I click to search view in a fragment, the fragment disappears (fell down). Google Maps and Places API work and in console I see error:

places.PlacesService.AutocompleteWidget: 100

I can't find what it could mean. I tried to use advices in this and this answers, but it didn't work.

My build.gradle implementations:

implementation 'com.google.android.gms:play-services:+'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:+'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-places:16.0.0'

Permissions and meta-data in Android.manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="it.mappe.permission.MAPS_RECEIVE" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="there_is_my_api_key"/>

In activity layout I have this XML:

SupportMapFragment mapFragment;
SupportPlaceAutocompleteFragment autocompleteFragment;
GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);
}
@Override
protected void onStart() {
    super.onStart();
    createMapView();
}

private void createMapView() {
    getSupportFragmentManager().executePendingTransactions();
    mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapView);
    mapFragment.getMapAsync(this);

    autocompleteFragment = (SupportPlaceAutocompleteFragment) getSupportFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
    AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
            .setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
            .build();

    autocompleteFragment.setFilter(typeFilter);
    autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {

        @Override
        public void onPlaceSelected(com.google.android.gms.location.places.Place place) {
            Log.i(TAG, "Place: " + place.getName());
        }

        @Override
        public void onError(Status status) {
            Log.e(TAG, "An error occurred: " + status + ", status code " + status.getStatusCode());
        }
    });
}

And when I tap searchview in fragment I see this in LogCat:

An error occurred: Status{statusCode=ERROR, resolution=null}, status code 13

And this page give me a beutiful explaination of "status code 13":

The operation failed with no more detailed information.

Thanks for any advice

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Narritt
  • 67
  • 1
  • 10

2 Answers2

0

get google API key from Google console and add in meta data

It would look something like : AIsddsfdsf-FAdsdsf6755fgfgdd3w

Official Guide How to generate Map API Key

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="there_is_my_api_key"/>
Kishore Jethava
  • 6,666
  • 5
  • 35
  • 51
  • I have my API key there, change that line only for this post. Google console shows positive requests to MapsSDK, but all requests to PlacesSDK have this error in console: places.PlacesService.AutocompleteWidget: 100 – Narritt Nov 27 '18 at 13:48
0

I got the same error "error 13" ,and I asked that question in stackoverflow .

Although I did not get any answer but I got a comment from the person who works at Google maps. He said its a bug from googles side
Here is the link to my question

I looked for answers try them :

api key library should consist places api for android,web and maps multidex support should be there

Kevin Kurien
  • 812
  • 6
  • 14
  • I made the new project and still have the same error. I can't understand your last phrase, cat you explain, please? – Narritt Nov 27 '18 at 13:53
  • I have made a demo on Autocompletefragment .Wait i'll post it on github and send you a link . That code works for me .Lets see if it works for you – Kevin Kurien Nov 27 '18 at 13:55
  • Thank you for your demo, it was very helpful, because it doesn't work with my API :) I make a new Google account and new payment account and now it works with new accounts, thank you! – Narritt Nov 28 '18 at 09:28
  • happy to help :) – Kevin Kurien Nov 28 '18 at 11:02