it’s very easy to make the device stay awake. First you need to enable the following two permissions in the -app.xml file:
<uses-permission android:name="android.permission.WAKE_LOCK">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD">
</uses-permission></uses-permission>
Then you need to use this simple line of code anytime you want to keep the device awake:
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
To enable the device to go to sleep again:
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
0 意見:
張貼留言