Reputation: 1382
I want to get the all places at my location. I am using google current place api
private void getCurrentPlaceData() {
mPlaceDetectionClient = Places.getPlaceDetectionClient(this);
Task<PlaceLikelihoodBufferResponse> placeResult = mPlaceDetectionClient.
getCurrentPlace(null);
placeResult.addOnCompleteListener(new OnCompleteListener<PlaceLikelihoodBufferResponse>() {
@Override
public void onComplete(@NonNull Task<PlaceLikelihoodBufferResponse> task) {
List<Place> placesList = new ArrayList<Place>();
PlaceLikelihoodBufferResponse likelyPlaces = task.getResult();
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
placesList.add(placeLikelihood.getPlace().freeze());
}
likelyPlaces.release();
showAddPropertyNameDialog(AppStringConstants.ADD_NEW_STORE_TAG, placesList.get(0));
}
});
}
and included following in manifest file
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_map_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
I have written above method for it. Now the problem is ... it is working fine above 6.0 fine but not below this.
com.google.android.gms.common.api.ApiException: 13: ERROR
and I have visited many links on this site no one helped.
Upvotes: 0
Views: 164
Reputation: 788
Add the below code in the <application>
tag in your manifest file.
<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="PASTE_YOUR_API_KEY_HERE" />
Upvotes: 1