Cant call onEvent for IOS
See original GitHub issueYour Environment
- Plugin version:^3.9.0
- Platform: iOS and Android, Real Device - iPhone Xs Max Software version 14.4
- OS version:any
- Device manufacturer / model:any
- React Native version (
react-native -v
):0.61.3 - Plugin config
async initBackgroundFetch() {
console.log('inside initBackgroundFetch IOS')
// BackgroundFetch event handler.
const onEvent = async (taskId: string | undefined) => {
console.log('inside onEvent')
// Do your background work...
logTestRepository.logToFirestore('BackgroundFetch IOS', 'BLA BLA')
// IMPORTANT: You must signal to the OS that your task is complete.
BackgroundFetch.finish(taskId)
}
// Timeout callback is executed when your Task has exceeded its allowed running-time.
// You must stop what you're doing immediately BackgorundFetch.finish(taskId)
const onTimeout = async (taskId: any) => {
console.log('inside onTimeout')
logTestRepository.logToFirestore('BackgroundTimeoutFetch IOS', 'BLA BLA')
BackgroundFetch.finish(taskId)
}
// Initialize BackgroundFetch only once when component mounts.
let status = await BackgroundFetch.configure(
{minimumFetchInterval: 15, enableHeadless: true, startOnBoot: true, stopOnTerminate: false},
onEvent,
onTimeout,
)
await logTestRepository.logToFirestore('status', 'lol')
console.log(status)
}
Expected Behavior
get log “BackgroundFetch IOS” inside onEvent (working on android)
Actual Behavior
On android, it works as expected in background and i get log “BackgroundFetch IOS”. But same code doesnt work on IOS in background.
Steps to Reproduce
Context
After every 15min or so, get log inside onEvent. I am able to get log “status” at the end .
Debug logs
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
If you can't make or receive calls on your iPhone - Apple Support
Check for any blocked phone numbers. Go to Settings > Phone > Blocked Contacts. See if Call Forwarding is turned on. Go to...
Read more >How to get a call event using CTCallCenter:setCallEventHandler
Task away from the app 5) Make a call from another device, answer the call, hang up the call from either device 6)...
Read more >Event.preventDefault() - Web APIs | MDN
You can use Event.cancelable to check if the event is cancelable. Calling preventDefault() for a non-cancelable event has no effect.
Read more >Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >daltoniam/Starscream: Websockets in swift for iOS and OSX
The closure of this would be: socket.onEvent = { event in switch event { // handle events just like above.
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 Free
Top 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
I installed testing app on sunday morning and opened,closed app throughout the day. I was able to get logs inside onEvent from 7pm to 9:30pm with 15~20min time difference. No logs at night. Next morning logs started coming again at the same rate. Long story short, is works exactly as written in Readme. Thankyou guys for support.
alright, I will do as advised and see what happens. Thankyou for your support!