Processing for Android

EN ES

hasPermission()

Use this function to check if a permission is granted to perform a specific operation. The permissions are idenfified with the string constants declared in the Manifest.permission package:


void setup() {
  requestPermission("android.permission.ACCESS_FINE_LOCATION");  
}

void draw() {
  if (hasPermission("android.permission.ACCESS_FINE_LOCATION")) {
    text("Location is available", width/2, height/2);
  } else {
    println("No permission to read location", width/2, height/2);
  }
}