Additional improvements in headless mode
See original GitHub issueHello, I would like to create PR with additional improvements related to headless mode. Before I create PR please let me know if it’s needed. My previous PR (#221 ) was left without any response so I’m trying to implement needed features on my fork and I can share them with community.
But let’s go back to new improvements: I took code from @manuquentin (#223) and added a few changes:
- I left old functionality of
backToForeground
, just added improvement for silent fail in the headless mode - I introduced a new method
openAppFromHeadlessMode
which can takecallUUID
and saves it - Whenever we want (especially after a cold boot) we can use another method
getExtrasFromHeadlessMode
and redirect to user’s call UI
With this PR we would be able to drop additional dependency like react-native-invoke-app
.
Demo:
messaging().setBackgroundMessageHandler(async notificaiton => {
return startCallFromBackgroundAndroid(notificaiton.data, headlessMode)
})
const startCallFromBackgroundAndroid = (payload, isHeadless) => {
// setup RNCallKeep
// set available
RNCallKeep.addEventListener('answerCall', ({ callUUID }) => {
RNCallKeep.openAppFromHeadlessMode(callUUID)
})
}
// Later eg. after navigation did mount:
useAsyncEffect(async () => {
const extras = await RNCallKeep.getExtrasFromHeadlessMode()
if (extras) {
navigation.navigate(ScreenNames.CallScreen, {
roomUUID: extras.callUUID
})
}
}, [])
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Using Headless Mode for Your Tests - When, Why and How
Test Automation engineers use headless browsers to run their automated scripts faster and in Continuous Integration and Delivery pipelines.
Read more >What is Google Chrome Headless Mode - DebugBar
The headless mode of the Google Chrome browser provides the ability to implement and run massive-scale web app tests, navigate from one page...
Read more >Headless Edit Mode – A non-scary way of working with “pure ...
Headless -only mode can be configured by developers. When enabled, the Multi-Channel Content gadget appears and hides the Navigation view (Pages, ...
Read more >Is Headless the smart way to go? - Numpy Ninja
Headless mode is not to run your program faster but headless mode makes your system memory utilization less and so better performance while ......
Read more >Why Should I Run My Selenium Tests in Headless? - SmartBear
Greater testing reach; Improved speed and performance; Multitasking. Greater testing reach. When running Selenium tests, you typically need a machine that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello everyone, I’m super busy and I can’t contribute here, what’s more, we are far behind each other. You can check my repo with a few additional improvements for Android (https://github.com/jpudysz/react-native-callkeep) - tested on production as I’m developing for my client’s VoIP app.
I tried to create PR here, but I changed
backToForeground
logic and it differs from original repo. New functionality such as headless mode, locked screen are strictly connected with this function and I can’t merge it. Ideally, we can take my ideas and merge it with the master (I don’t mind and you can copy-paste my code under your PR). Ping me if I needed.PS. I added changelog inside my repo, so you can check new functionalities. @manuquentin if you want to discuss how to merge it or you need some explanation ping/PM me.
I’m happy that I was able to help someone. Cheers from Poland!