React Native app on lockscreen

Issue

I have an app with the MainActivity.java code that works on the lockscreen. However, I need to make only certain screens work on the lockscreen. To do this, I have created a native module called react-native-keep-awake which can be installed with npm install --save https://github.com/willnaoosmit/react-native-keep-visible (or with yarn). To use this module, import it with import KeepAwake from 'react-native-keep-awake' and call KeepAwake.activate() when you want to use the app on the lockscreen and KeepAwake.deactivate() when you don’t want to use the app on the lockscreen anymore.

Answer

To make only certain screens work on the lockscreen, you can import the KeepAwake module in the specific screens where you want to use the app on the lockscreen. Then, call KeepAwake.activate() when you want to use the app on the lockscreen and KeepAwake.deactivate() when you don’t want to use the app on the lockscreen anymore. This will keep the screen awake only for the specific screens where you have called KeepAwake.activate().