Closed varungupta85 closed 5 years ago
Any updates on this? @varungupta85 were you able to solve for / workaround this?
I'm building a VoIP app and need to show the app over the lock screen on receiving push notifications. I'm able to show the app when the app is still in the background, no problems there. The screen wakes up and the app is fully interactive.
The problem arises when the app has been killed and the devices is locked. The app does start (as I am able to see logs on my Chrome debugger), but a) the app doesn't show up over the lock screen b) upon unlocking, the app shows up, but is stuck at the splash screen.
These are the flags that are enabled in my MainActivity
:
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
window.clearFlags(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY);
In addition to the issue of being stuck on the splash screen, I would also greatly appreciate any guidance on how I can get the app to show over the lock screen when the app has been killed, as I am not a native Android developer.
Edit: I've added more details in this SO question.
@platonish No progress on solution for the problem. I am not sure if you can show a react-native screen when the app is locked or the app is not in foreground. For such cases, we use natively defined Android activities.
@guyca Please share if you have any inputs on this issue.
+1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
+1
Issue Description
Android app gets stuck on the launch screen when triggered from a notification on a locked screen and the app is not running in the background.
Steps to Reproduce / Code Snippets / Screenshots
In my setup, it happens when the phone is locked and the app is not running in the background and I tap on a user notification for the app that will basically launch the app.
I have created a detox text to simulate this behaviour. I have created two tests:
Below are the tests: P.S. Make sure that the emulator on which the tests will be run has a screen lock set to PIN and the PIN is 1234. I ran the tests on the default Pixel_2_API_26
Launch the app when device is locked
Launch the app when device in not locked
Below is the code for the method
unlockPhoneByPin
that I added toAndroidUtils.js
Observe that the first test fails because the app gets stuck on the splash screen.
I did some investigation into the code to find out why it is happening and I found that the
Navigation.setRoot
method is not executed fully. We have a check to make sure that the current activity is not null before setting the root and the current activity happens to be null in this case.Environment