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

后端 未结 2 1480
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条回答
  •  再見小時候
    2021-01-14 21:46

    Since that day I couldn't find any way to detect Lock/Unlock event in React native.

    Solution:

    1. We've created sample modules in Android and iOS separate (Native code to get Lock/Unlock events)
    2. Using Android studio / XCode we've exported as React native modules
    3. Imported these modules in React native

    It works fine for us.

    Hope this would help you.

提交回复
热议问题