Within appstudio, is there a way to keep the screen from going to standby and locking while your app is running? I'm using appstudio desktop version 3.0.53 and configuring the quick capture template.
Thanks.
Solved! Go to Solution.
Hi Brian,
The Platform.stayAwake = true should set inside a signal handler, for example, in the code sample below, stayAwake is inside an onClicked signal. If you wish to keep the screen on when opening the app, you can put stayAwake inside Component.onCompleted.
Note: Best practice for using stay awake is to set this property to false before the app is minimized or closed.
import ArcGIS.AppFramework.Platform 1.0ColumnLayout {anchors.fill: parentButton {text: "Enable Stay Awake"onClicked: {Platform.stayAwake = true;}
}
Button {text: "Disable Stay Awake"onClicked: {Platform.stayAwake = false;}
} }
Hi Brian,
The upcoming AppStudio 3.2 release (December 2018) will roll out a new Platform plugin, which includes a stayAwake property that can prevent your device from going to sleep. Please keep an eye on the AppStudio 3.2 release blog post. I hope it helps.
Thanks,
Tina
That would be great! Thx!
I am now working with Appstudio 3.2. I am using the QuickCapture template as well. I placed "property bool stayAwake: true" in several places but I can't seem to get it to work. I would like the screen to stay on while the app is open or while the data capture page is open. Can you help me understand how to use this feature? I apologize if this seems like a basic question. Thanks for your time.
Hi Brian,
The Platform.stayAwake = true should set inside a signal handler, for example, in the code sample below, stayAwake is inside an onClicked signal. If you wish to keep the screen on when opening the app, you can put stayAwake inside Component.onCompleted.
Note: Best practice for using stay awake is to set this property to false before the app is minimized or closed.
import ArcGIS.AppFramework.Platform 1.0ColumnLayout {anchors.fill: parentButton {text: "Enable Stay Awake"onClicked: {Platform.stayAwake = true;}
}
Button {text: "Disable Stay Awake"onClicked: {Platform.stayAwake = false;}
} }
Thanks Tina, this is very helpful and a great new feature. I really appreciate the quick and detailed response. Thanks again.
This function appears to only work while using in the appstudio player. When I built an apk file and deployed the app through the playstore, the stayawake function did not work.
Hi Brian,
This is odd because I have tested stay-awake function in a stand-alone app on Android devices and it works well.
Tina
Hey Tina,
I was able to get stayAwake to work with an app from the google play store. It did not work when adding the property in the Component.onCompleted section of the code of an app in the play store but it did within the appstudio player. So, I added stayAwake to an onselected function within the code and it works. I'm not sure if this is a coding issue or just an issue of my understanding of the quickcapture application. Thanks Tina Jin for all the help on this.