Android Location Permissions

AreaMetrics Snippet requires ACCESS_COARSE_LOCATION permission, and on Android M+ that permission needs be requested during runtime.

Runtime Location Permission Request

Our Altbeacon dependency already adds ACCESS_COARSE_LOCATION to your AndroidManifest.xml, so all that's left is the code for showing the runtime permission prompt. Ask for location permission at a moment in your app the user will understand such as after on-boarding or in a specific area of your app.

MyActivity.java
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1);
}