flutter_background_service icon indicating copy to clipboard operation
flutter_background_service copied to clipboard

keeping the service running even if the app is killed iOS

Open EbramTawfik opened this issue 4 years ago • 4 comments

How to keep the service running even if the app is killed on iOS?

EbramTawfik avatar Dec 24 '20 01:12 EbramTawfik

currently, iOS natively doesn't have any background service like android

ekasetiawans avatar Dec 24 '20 05:12 ekasetiawans

I am trying to send messages "Alerts" from server to mobile app built in flutter and once the app received the message it should show Notifications to the user even if it is closed or in background. I want to receive real-time notifications. I am using websocket to send the alerts from the server.

For android: I was able to create Android foreground service using the package. I was able to open websocket connection and show notification once the alert received even if the app is closed the service was able to show the notification message.

For iOS?! I want to do the same for iOS but once the app in background or closed I am not able to receive the alert from the server. How can I receive notifications even if the iOS in background or closed? If I changed the way that I use to send the notification from the server will that help (I don’t want to use cloud “FCM”)?

I noticed many apps on iOS like (outlook ,..) you can receive the notification even if the app is closed. So how can I have the same behavior?

EbramTawfik avatar Dec 24 '20 07:12 EbramTawfik

You can't do that on iOS because there's no background service feature on iOS. One thing that might be done is to use background fetch, but background fetch does not run continuously but is executed at a certain period. Realtime notification can be done using APNS.

ekasetiawans avatar Dec 24 '20 07:12 ekasetiawans

I am trying to send messages "Alerts" from server to mobile app built in flutter and once the app received the message it should show Notifications to the user even if it is closed or in background. I want to receive real-time notifications. I am using websocket to send the alerts from the server.

For android: I was able to create Android foreground service using the package. I was able to open websocket connection and show notification once the alert received even if the app is closed the service was able to show the notification message.

For iOS?! I want to do the same for iOS but once the app in background or closed I am not able to receive the alert from the server. How can I receive notifications even if the iOS in background or closed? If I changed the way that I use to send the notification from the server will that help (I don’t want to use cloud “FCM”)?

I noticed many apps on iOS like (outlook ,..) you can receive the notification even if the app is closed. So how can I have the same behavior?

i am also trying to achieve this. There are apps on ios app store they are doing it like this : Tabtrader https://apps.apple.com/us/app/tabtrader/id1095716562 .

j33tmane avatar Jun 19 '21 14:06 j33tmane