简体   繁体   中英

Android Google map with nearby places

I am using Android Studio latest version and SDK version 23.0.0 When I follow this link to get a nearby map application nothing happens, and it only shows that your Unfortunately your app has stopped. The link is

http://karnshah8890.blogspot.in/2013/03/google-places-api-tutorial.html

and I think a lot of links I followed did not help in creating a nearby places application, any one please help me.

This tutorial is based on the Places API Web Service.

We recently released Places API for Android , which includes PlaceDetectionApi.getCurrentPlace() .

Example:

PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
    .getCurrentPlace(mGoogleApiClient, null);
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
  @Override
  public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
    for (PlaceLikelihood placeLikelihood : likelyPlaces) {
      Log.i(TAG, String.format("Place '%s' has likelihood: %g",
          placeLikelihood.getPlace().getName(),
          placeLikelihood.getLikelihood()));
    }
    likelyPlaces.release();
  }
});

You will also need to enable Places API for Android in the Google Developers Console and add an Android API key to your AndroidManifest.xml. See the setup instructions here .

I hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM