React Native: How to detect device lock/unlock event?

后端 未结 2 1500
Happy的楠姐
Happy的楠姐 2021-01-14 21:12

Concept:

My application needs to record user activities on phone. Activities contain Foreground, Background, Kill, Lock and Unlock.

2条回答
  •  萌比男神i
    2021-01-14 22:04

    Your app is pretty much a sandbox within your device. Listening to unlock states is not tied to anything within your app.

    Your next best hope is to do something like this, but I would not recommend it as it most likely violates private API's (This is iOS only): https://stackoverflow.com/a/14271705/1363779

提交回复
热议问题