Processing for Android

EN ES

requestPermission()

Use this function to request "dangerous" permissions on runtime (this happens only when running the app on devices with Android 6 or newer), and set the function in the sketch that should handle the result:


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

void draw() {
  // ...  
}

void initLocation(boolean granted) {
  if (granted) {   
    println("init location manager");
    // ...
  } else {
    println("location is not available");
    // ...
  }
}