Nico
Nico

Reputation: 167

React Native detect screen lock/unlock when app is running in the back ground

Problem: I need a way to measure if the screen is locked/unlocked while my app is running in the background.

What I have tried: Using React Native's App State, I can measure if the App is active, but there is no differentiation between the App being in the background or the screen is locked.

I have found this duplicate, however since there has been no solution given I have opened a new question.

I'm looking for a solution for Android.

Upvotes: 1

Views: 4279

Answers (1)

docmurloc
docmurloc

Reputation: 1239

When your application is in the background, the process running React Native is paused. You cannot manage your event from inside your application.

The only solution is to use headless js.

Upvotes: 1

Related Questions