您可以使用Qt Android Extras模块并使用JNI从C ++调用相关的Java函数。就像是 :
void keepScreenOn() { QAndroidJniObject activity = QtAndroid::androidActivity(); if (activity.isValid()) { QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;"); if (window.isValid()) { const int FLAG_KEEP_SCREEN_ON = 128; window.callObjectMethod("addFlags", "(I)V", FLAG_KEEP_SCREEN_ON); } }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)