Closed railsfactory-ashish closed 1 month ago
@christocracy I have downloaded the repo and installed the FetchDemo app in my iPhone through Xcode and I could see UI that the app can show all the events that will be triggered in killed state and should be displayed whenever I will open the app letter. but so far no events I could see. Please let me know if I am missing any steps?
same here,. so not working on real ios device
help me please.
In the README are instructions on how to simulate iOS fetch events. That's all you need to do to know that the plugin works.
iOS can take days before their machine learning algorithm begins firing regular events. The best thing you can do to ensure events begin firing is to periodically open the app, to simulate real human behaviour.
Also note the iOS does NOT fire fetch events after app terminate (there is no such thing as stopOnTerminate: false
for iOS background-fetch.
@christocracy Yet another question to avoid a new issue creating (it's related to this topic): when I run app from XCode (on a real device) and do "Debug > Simulate background fetch" action - the background task is not called for me. But when I use "e -l objc ..." method, it is called. And what is very confused, "Debug > Simulate background fetch" action works in the Simulator for me (expo 49, latest plugin version). Is it ok? Because in the documentation is read that it should be vice versa - work on real device and don't on the simulator.
"Debug > Simulate background fetch"
that uses the old, deprecated iOS api. Don’t use that anymore.
Your Environment
react-native -v
): 0.72.4Expected Behaviour
The plugin should trigger notification after every 15 mins when app is killed.
Actual Behaviour
Not getting triggered even single time.
Steps to Reproduce
const initBackgroundFetch = async () => { const status = await BackgroundFetch.configure( { minimumFetchInterval: 15, stopOnTerminate: false, enableHeadless: true, startOnBoot: true, }, handleTask, onTimeout ); BackgroundFetch.start().then((value) => console.log(value, 'ok')); };
// handleTask is called periodically when RNBF triggers an event const handleTask = async (taskId) => { console.log('nops'); triggerNotification(); BackgroundFetch.finish(taskId); };
const triggerNotification = () => { const time = DateTime.now().plus({ seconds: 60 }); const jsDate = DateTime.now().set({ hour: time.get('hour'), minute: time.get('minute'), }); console.log(jsDate.toMillis(), 'jsDate.toMillis()'); const trigger = { type: TriggerType.TIMESTAMP, timestamp: jsDate.toMillis(), alarmManager: { allowWhileIdle: true, }, }; notifee.createTriggerNotification( { id: v4(), title: 'test', body: 'opps', data: { type: 'task', id: 'nope', }, ios: { sound: 'default', categoryId: 'done', }, }, trigger ); }; const onTimeout = async () => { // The timeout function is called when the OS signals that the task has reached its maximum execution time.
// ADD CLEANUP WORK HERE (IF NEEDED)
BackgroundFetch.finish(taskId); }; initBackgroundFetch() // calling the function here
Context
I was trying to trigger notification every 15 mins
Debug logs
2023-09-16 12:14:00.916686+0530 myiOSApp[29397:1314042] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 95 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 95 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.} 2023-09-16 12:14:00.938540+0530 myiOSApp[29397:1314037] 10.14.0 -[I-ACS025027] Deferring to Google Analytics for Firebase for event data collection. https://goo.gl/YNbdK2
2023-09-16 12:14:00.961875+0530 myiOSApp[29397:1314047] [javascript] Running "myiOSApp
2023-09-16 12:14:00.992622+0530 myiOSApp[29397:1314047] [javascript] 1694846700992, 'jsDate.toMillis()'
2023-09-16 12:14:01.038791+0530 myiOSApp[29397:1313806] [TSBackgroundFetch scheduleBGAppRefresh] com.transistorsoft.fetch
2023-09-16 12:14:01.078182+0530 myiOSApp[29397:1314047] [javascript] iosStoreURL is not set.
2023-09-16 12:14:01.118963+0530 myiOSApp[29397:1313806] To get test ads on this device, set:
Objective-C
GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ @"1ae1bc50e874a825f4fdd7e4120a5c60" ];
Swift
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ "1ae1bc50e874a825f4fdd7e4120a5c60" ]
2023-09-16 12:14:01.249680+0530 myiOSApp[29397:1313806] [TSBackgroundFetch start] (null)
2023-09-16 12:14:01.250944+0530 myiOSApp[29397:1314047] [javascript] 2, 'ok'
2023-09-16 12:14:01.373245+0530 myiOSApp[29397:1314046] [quic] quic_crypto_session_state_serialize [C1.1.1.1:2] [-ef6b0ba9525f4045] TLS ticket does not fit (6927 > 6144)
2023-09-16 12:14:01.373386+0530 myiOSApp[29397:1314046] [quic] quic_crypto_session_state_serialize [C1.1.1.1:2] [-ef6b0ba9525f4045] TLS ticket does not fit (6927 > 6144)
2023-09-16 12:14:29.731285+0530 myiOSApp[29397:1314045] [connection] nw_connection_add_timestamp_locked_on_nw_queue [C1] Hit maximum timestamp count, will start dropping events
2023-09-16 12:14:29.734747+0530 myiOSApp[29397:1314045] [connection] nw_connection_add_timestamp_locked_on_nw_queue [C3] Hit maximum timestamp count, will start dropping events
2023-09-16 12:15:14.993123+0530 myiOSApp[29397:1313806] [TSBackgroundFetch onAppTerminate]