Search code examples
androidcordovaphonegap

Can I detect when a user unlocks their phone with cordova/phonegap?


I'm using cordova to make an app where a timer is turned on once the user unlocks their android phone, is there any way I can use a plugin to detect when this happens?

I haven't found any way of fixing this issue

I'm hoping once this is finished I can start a timer when I've got this code, thank you so much for any help provided


Solution

  • cordova-plugin-lock-info can help with that. You might also want cordova-plugin-background-mode as well if you want the timer to continue even when the app is in the background. But be aware - your timer may or may not be accurate because your timer will not be running in the foreground at all times and may not be respected by the browser.