My android game uses OpenGL and Android NDK. I am currently passing the necessary dpi values as parameters, by making JNI native call from my Activity/GLSurfaceView.
Currently I am using :
// request an instance of DisplayMetrics, say 'dm' from android.
float densityFactor = dm.density;
// pass this as a parameter using JNI call
myCustomNativeMethod(densityFactor); # implementation in a 'game.c' file
I was just wondering if one can access the android environment parameters without using JNI to receive them (the parameters). May be like, importing some low level NDK header files (.h) that will help me communicate directly with the UI system or something?
I mean like:
#import <android_displayparams.h>
...
float densityfactor = getDisplayParamDensity(); // <- Is this possible?
Note: This is a question out of curiosity, and I am aware that such a mechanism might not be a good practice.