Skip to content

Instantly share code, notes, and snippets.

@salmanyaqoob
Created March 29, 2021 07:45
Show Gist options
  • Select an option

  • Save salmanyaqoob/c78275d71c72224e3c7ec33d1d238c8e to your computer and use it in GitHub Desktop.

Select an option

Save salmanyaqoob/c78275d71c72224e3c7ec33d1d238c8e to your computer and use it in GitHub Desktop.
onReady() {
this.setBrightnessKeepScreenOn();
},
onInit() {
this.initLocationCompass();
},
exit(){
app.terminate();
},
retry(){
this.isLocationLoading = true;
this.isLocationError = false;
this.initLocationCompass();
},
onDestroy() {
sensor.unsubscribeCompass();
},
// Setting the screen to be steady on
setBrightnessKeepScreenOn: function () {
brightness.setKeepScreenOn({
keepScreenOn: true,
success: function () {
console.log("handling set keep screen on success")
},
fail: function (data, code) {
console.log("handling set keep screen on fail, code:" + code);
}
});
},
onBackPress() {
sensor.unsubscribeCompass();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment