Hi There,
I'm fixing chat application bug right now. The problem here is when i send message at offline mode and go to background mode. I can only resend the message automatically under 30 seconds after go to background mode.
If i don't go online after 30 seconds. I cannot send the message automatically from background.
I'm using this function
I have also tried to changed the duration in AppDelegate with this function from
to
or
but still, it doesn't working. It only give us 30 seconds for the maximum time.
Is there any solutions to resend message at the background mode automatically after 30 seconds ?
(WhatsApp can do this, so it should be possible)
I'm fixing chat application bug right now. The problem here is when i send message at offline mode and go to background mode. I can only resend the message automatically under 30 seconds after go to background mode.
If i don't go online after 30 seconds. I cannot send the message automatically from background.
I'm using this function
Code Block language func beginBackgroundTask(expirationHandler handler: (() -> Void)? = nil) -> UIBackgroundTaskIdentifier
I have also tried to changed the duration in AppDelegate with this function from
Code Block language application.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum)
to
Code Block language application.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalNever)
or
Code Block language application.setMinimumBackgroundFetchInterval(3600)
but still, it doesn't working. It only give us 30 seconds for the maximum time.
Is there any solutions to resend message at the background mode automatically after 30 seconds ?
(WhatsApp can do this, so it should be possible)