Writing permissions at runtime (Android Mode 4.0.1)


I’m using the code below to ask for writing permissions on my Processing/Android sketch:

The problem is that ActivityCompat is not recognised (nor import android.support.v4.app.ActivityCompat).

I found a support-v4-26.0.0-alpha1-sources.jar file in the SDK files downloaded automatically by Processing, but I’m not able to correctly import it to the sketch.

I’m using Android Mode 4.0.1, and the Android SDK Platform 26.



As you can easyly verify looking to the code of the launcher activity (or to the build.gradle), processing extends AppCompatActivity and declares v7 as a dependency: so you have not to try to import it and the problem you get is not this one; it’ s that you are in a (kind-of) Fragment (PFragment, which extends Fragment) and the code you are using is not for a fragment but for an activity…Adapt your code (if you need i can put code for that, though i think i have already done that in the old forum)