You must use the native iOS api. You can compile ObjC ++ code directly with the clang compiler in your Qt application.
This way you can mix files .cppand .mm(ObjC ++). QtCreator and qmakesupport this with a keyword OBJECTIVE_SOURCES.
In implementation yourclass.mm:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
void YourClass::setTimerDisabled() {
[[UIApplication sharedApplication] setIdleTimerDisabled: YES]
}
yourclass.h:
class YourClass
{
public:
void setTimerDisabled()
}
Qt-:
YourClass yc;
yc.setTimerDisbabled();
(.pro), iOS:
ios {
OBJECTIVE_SOURCES += \
yourclass.mm \
}
, , :
#if defined(Q_OS_IOS)
#elsif defined(Q_OS_ANDROID)
#else
#endif