Issue
I’m developing a navigation app with Ionic framework. Is there a way to keep the screen of the device open while the app is up and running ?
Solution
Yes you can Keep screen Active:
There is a cordova plugin for this:
ionic cordova plugin add cordova-plugin-insomnia
npm install @ionic-native/insomnia
import { Insomnia } from '@ionic-native/insomnia/ngx';
constructor(private insomnia: Insomnia) { }
...
this.insomnia.keepAwake()
.then(
() => console.log('success'),
() => console.log('error')
);
this.insomnia.allowSleepAgain()
.then(
() => console.log('success'),
() => console.log('error')
)
Check Plugin Docs here Cordova Insomnia Docs
Answered By – Najam Us Saqib
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0