flutter_background_service
flutter_background_service copied to clipboard
How To Stop Background Service In iOS Only?
Hi; I am using this plugin for my Foreground/Background Service in Android and iOS but due to the limitation of this plugin in iOS Background service to be terminated after 30 sec, I am working on an alternative to keep the service active forever in iOS Background so I need to stop this plugin iOS Background Service only so that I can work in Native iOS for this task.
So for this, I did the following confrigration but it is giving me the error as Could not schedule app refresh: Error Domain=BGTaskSchedulerErrorDomain Code=3 "(null)"
await service.configure(
androidConfiguration: AndroidConfiguration(
// This will be executed when app is in foreground or background in separated isolate
onStart: onStart,
// Auto start service
autoStart: true,
isForegroundMode: true,
),
iosConfiguration: IosConfiguration(
// auto start service
autoStart: true,
// this will be executed when app is in foreground in separated isolate
onForeground: onStart,
// you have to enable background fetch capability on xcode project
// onBackground: onIosBackground, //COMMENTED THIS LINE TO STOP RUNNING IN IOS BACKGROUND
),
);
So whats the correct way to stop background service in iOS only?
in Android i have use this code to stop service also works in IOS
service.on('stopService').listen((event) {
try {
//your function if service is going to stop
service.stopSelf();
} catch (ex) {
log(ex.toString());
}
});
but i am facing issue is how to keep running this service after user clear the app from task manager in IOS
I don't know how to run the service in background or in foreground in IOS. Please tell me about it.
in Android i have use this code to stop service also works in IOS
service.on('stopService').listen((event) { try { //your function if service is going to stop service.stopSelf(); } catch (ex) { log(ex.toString()); } });
but i am facing issue is how to keep running this service after user clear the app from task manager in IOS
HI @jaypathak9460 I am also looking for the same. If you got anything, it will be very help full to share here or if I got something then I will share it here.
I don't know how to run the service in background or in foreground in IOS. Please tell me about it.
Hi @Sneh-Paghdal
Just run your code in main()
for foreground service and currently it is not possible to keep continuous background service in iOS.
It's also not working in foreground in ios. can you tell me more about it? It would be a big help to me.
On Thu, 31 Aug 2023 at 11:51, Muhammad Hassan @.***> wrote:
I don't know how to run the service in background or in foreground in IOS. Please tell me about it.
Hi @Sneh-Paghdal https://github.com/Sneh-Paghdal Just run your code in main()for foreground service and currently it is not possible to keep continuous background service in iOS.
— Reply to this email directly, view it on GitHub https://github.com/ekasetiawans/flutter_background_service/issues/310#issuecomment-1700431569, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOB2B2QCHXP5XFOFEMIRLXYAUM5ANCNFSM6AAAAAAYSSTAZ4 . You are receiving this because you were mentioned.Message ID: @.***>
It's also not working in foreground in ios. can you tell me more about it? It would be a big help to me. … On Thu, 31 Aug 2023 at 11:51, Muhammad Hassan @.> wrote: I don't know how to run the service in background or in foreground in IOS. Please tell me about it. Hi @Sneh-Paghdal https://github.com/Sneh-Paghdal Just run your code in main()for foreground service and currently it is not possible to keep continuous background service in iOS. — Reply to this email directly, view it on GitHub <#310 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOB2B2QCHXP5XFOFEMIRLXYAUM5ANCNFSM6AAAAAAYSSTAZ4 . You are receiving this because you were mentioned.Message ID: @.>
Sure but this ticket is something different so stick to this here rest ask question directly about anything else.
i was thinking to create whole thing in swift but the issue is i do not have any idea about swift code and how to create it.so i dropped the plan😅😅
It's also not working in foreground in ios. can you tell me more about it? It would be a big help to me. … On Thu, 31 Aug 2023 at 11:51, Muhammad Hassan @.> wrote: I don't know how to run the service in background or in foreground in IOS. Please tell me about it. Hi @Sneh-Paghdal https://github.com/Sneh-Paghdal Just run your code in main()for foreground service and currently it is not possible to keep continuous background service in iOS. — Reply to this email directly, view it on GitHub <#310 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOB2B2QCHXP5XFOFEMIRLXYAUM5ANCNFSM6AAAAAAYSSTAZ4 . You are receiving this because you were mentioned.Message ID: @.>
You can follow YT Videos for the same and set some permission for IOS and its done but still it will be killed by IOS in background as soon as app was removed from task manager(Recent),
@jaypathak9460 Well I am good with keeping the Background Running in the iOS continuously using this plugin and some swift touches thats why I want to stop this plugin iOS background service to stop interruption. ;-*
@jaypathak9460 Well I am good with keeping the Background Running in the iOS continuously using this plugin and some swift touches thats why I want to stop this plugin iOS background service to stop interruption. ;-*
hi, can you share some of your swift code for running these iOS on background? cause i am facing this issue for quite a moment, thanks.