I have an Android app that includes a C library using NDK to execute some some code. Within the C library I would like to update the applications shared preferences. My question… is it possible to read/edit shared preferences in native code?
Share
You can do anything you want in native code. It’s just cumbersome – you need the JNIEnv object to first find the class ID, then the method ID, if you have any non-primitive types, you need to create those too. But then you just call the method, and you’re done.
JNI Docs – look for
FindClass,GetMethodId,CallVoidMethod, etc.