Unsolved Using JNI
-
Could you please give a sample of code?
I don't understand what exactly i have to do. -
Hi
Syntax should be the same.
https://www.somacon.com/p125.php
For the OR part but are you talking about the actual pm.newWakeLock call or
simply the
PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP ? -
If i use | this cause error. It says that there is not such flag.
-
@NickV
Hi
can you show exact error ?
Maybe it just dont know PowerManager.SCREEN_DIM_WAKE_LOCK etc. -
java.lang.NoSuchFieldError: no "I" field "SCREEN_DIM_WAKE_LOCK|ACQUIRE_CAUSES_WAKEUP" in class "Landroid/os/PowerManager;" or its superclasses
-
@NickV
Oh, we read it all completely wrong.
Its not in c++ , but java ? -
I am using QAndroidJniObject in order to call power manager and set cpu flags. The code is the above code that i've posted. Look the initial post.
-
@NickV
Hi
Seems like it dont know
PowerManager.SCREEN_DIM_WAKE_LOCK
Do you know where its normally defined ? -
No. If i use only SCREEN_DIM_WAKE_LOCK no error produced. Look this link
-
@NickV
But it dont work without PowerManager.ACQUIRE_CAUSES_WAKEUP ? -
No it works but i need this extra flag in order to do some work.
-
@NickV
But did u look where SCREEN_DIM_WAKE_LOCK is defined ?
Does it define the ACQUIRE_CAUSES_WAKEUP at all ?
maybe it was added in later version of the SDK. -
Ok! Thanks for your response!
-
@NickV
For me something is not clear, did you already try the following or not?!jint levelAndFlags = QAndroidJniObject::getStaticField<jint>("android/os/PowerManager","SCREEN_DIM_WAKE_LOCK") | QAndroidJniObject::getStaticField<jint>("android/os/PowerManager","ACQUIRE_CAUSES_WAKEUP");