StrongLucky
StrongLucky

Reputation: 588

Ionic 2 - Detect if screen is locked

I searched for a long time now and could not find any result.

I need an Event or a Method in Ionic 2 to check the stat of the Phone Display - Is the display locked or unlocked.

Another option would be to check if the user is active. But think the Lockscreen would be better.

Upvotes: 2

Views: 1917

Answers (1)

Manoj Bhardwaj
Manoj Bhardwaj

Reputation: 858

Try with platform customization

constructor( private platform: Platform ) {
platform.ready().then(() => {    
    this.platform.pause.subscribe(() => {
        console.log('[INFO] App paused');
    });

    this.platform.resume.subscribe(() => {
        console.log('[INFO] App resumed');
    });
});

}

Upvotes: 1

Related Questions