You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is our Background code Service code.
IOS Simulator Background Service Timer. periodic working perfectly
but Real Device iPhone 7 can not support in release and debug mode in background please suggestion how to resolved this issue
AudioServices.dart
class AudioServices {
AudioServices();
Future initializeService() async {
final service = FlutterBackgroundService();
Hello
This is our Background code Service code.
IOS Simulator Background Service Timer. periodic working perfectly
but Real Device iPhone 7 can not support in release and debug mode in background please suggestion how to resolved this issue
AudioServices.dart
class AudioServices {
AudioServices();
Future initializeService() async {
final service = FlutterBackgroundService();
}
Future startService() async {
final service = FlutterBackgroundService();
await service.startService();
}
Future stopService() async {
final service = FlutterBackgroundService();
if (await service.isRunning()) {
service.invoke('stop');
AppGlobal.printLog("Services Stop");
}
}
@pragma('vm:entry-point')
static Future onStartTime(ServiceInstance service) async {
Timer? timer; // Declare a timer reference
if (service is AndroidServiceInstance) {
service.setAsForegroundService();
}
timer = Timer.periodic(const Duration(minutes: 1), (timer) async {
AppGlobal.printLog("Sound Timer : ${timer.tick}");
if (service is AndroidServiceInstance && !(await service.isForegroundService())) {
timer.cancel();
AppGlobal.printLog("Services STOP and Timer Cancel return here");
return;
}
}
@pragma('vm:entry-point')
Future onIosBackground(ServiceInstance service) async {
WidgetsFlutterBinding.ensureInitialized();
DartPluginRegistrant.ensureInitialized();
AppGlobal.printLog("App Background Mode.");
return true;
}
}
AppDelegate.swift
import UIKit
import Flutter
import UserNotifications
import alarm
import flutter_background_service_ios
//import workmanager
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
SwiftFlutterBackgroundServicePlugin.taskIdentifier = "dev.flutter.background.refresh"
// WorkmanagerPlugin.setPluginRegistrantCallback { (registry) in
// GeneratedPluginRegistrant.register(with: registry)
// }
// WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "com.therapo.audioTask", frequency: NSNumber(value: 1))
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
SwiftAlarmPlugin.registerBackgroundTasks()
}
}
Info.plist
BGTaskSchedulerPermittedIdentifiers
audioTask
dev.flutter.background.refresh
UIBackgroundModes
audio
fetch
processing
The text was updated successfully, but these errors were encountered: