Page updated Nov 9, 2023

Use Amazon Location Service SDK

Amplify Android v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Library for Android to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

If you need functionality in the AWS services used by the Amplify Geo category that isn't available, we provide an escape hatch so you can get a reference to that service.

Note: If you provisioned your Geo resources via Amplify CLI, then the IAM policy will be specifically scoped to only allow actions required by the library. Please adjust your authorization permissions accordingly for your escape hatch use-cases.

import android.util.Log; import com.amazonaws.services.geo.AmazonLocationClient; import com.amazonaws.services.geo.model.ListMapsRequest; import com.amazonaws.services.geo.model.ListMapsResult; import com.amplifyframework.core.Amplify; import com.amplifyframework.geo.location.AWSLocationGeoPlugin;
1import android.util.Log;
2import com.amazonaws.services.geo.AmazonLocationClient;
3import com.amazonaws.services.geo.model.ListMapsRequest;
4import com.amazonaws.services.geo.model.ListMapsResult;
5import com.amplifyframework.core.Amplify;
6import com.amplifyframework.geo.location.AWSLocationGeoPlugin;
// Obtain reference to the plugin AWSLocationGeoPlugin geoPlugin = (AWSLocationGeoPlugin) Amplify.Geo.getPlugin("awsLocationGeoPlugin"); AmazonLocationClient locationClient = geoPlugin.getEscapeHatch(); // Send a new request to the Location Maps endpoint directly using the client ListMapsRequest request = new ListMapsRequest(); ListMapsResult response = locationClient.listMaps(request); Log.i("MyAmplifyApp", response.getEntries().toString());
1// Obtain reference to the plugin
2AWSLocationGeoPlugin geoPlugin = (AWSLocationGeoPlugin)
3 Amplify.Geo.getPlugin("awsLocationGeoPlugin");
4AmazonLocationClient locationClient = geoPlugin.getEscapeHatch();
5
6// Send a new request to the Location Maps endpoint directly using the client
7ListMapsRequest request = new ListMapsRequest();
8ListMapsResult response = locationClient.listMaps(request);
9Log.i("MyAmplifyApp", response.getEntries().toString());

Documentation Resources

Maps

Places

Device Tracking