简体   繁体   中英

How to awake phone screen when app is in background and screen is locked in react native?

I'm making an application, Let's see what i want to do actually. I executed my code using react-native run-android and my home screen is active now. Then i went to the background and locked my phone using lock key of the mobile phone. then i'm sending notification to the app, the notification is being showing in the phone but the screen is still locked, home screen is still inactive. I want to awake my phone on receiving notification and i have used react-native-firebase for push notification.

Thank You.

I had tried to make it using react-native-keep-awake.

On receiving the notification, My code is KeepAwake.activate() but its not awaking my screen.

react-native-keep-awake will only work when the app is in foreground. What it does is that it simulates the manual touch to keep awake feature. Especially used in video player apps and navigation apps when the app is in foreground and you do not want to get the screen get automatically locked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM