I’m working on a JUCE-based library, which requires audio input.
When I call
RuntimePermissions::request I get a JNI crash, which seems to be because it cannot get a reference to the current Activity:
JNI DETECTED ERROR IN APPLICATION: can't call android.app.FragmentManager android.app.Activity.getFragmentManager() on null object
The line it crashes on is in
LocalRef<jobject> fm (env->CallObjectMethod (getCurrentActivity().get(), AndroidActivity.getFragmentManager));
Following the debugger, it looks like
getCurrentActivity() is not returning a nullptr, however that might not be the case since its actually a Java object. I refactored my app so that it runs the function which calls
RuntimePermissions::request in the
onCreate method of my main Activity, but that didn’t help.
One line of attack might be to pass in the Activity context directly, but that would be mean hacking JUCE code which I would like to avoid, plus it looks like its designed to pass in the current activity with
Maybe I need to explicitly register the Activity where I am calling
RuntimePermissions::request with the