currently I am working on a Flutter Project where I use different plugins like ble_peripheral, Flutter_blue, Firebase,...
I am working on the Androind and iOS platform. The app is working fine and like expected everything is running smooth till now. Now I am at the point where I want to check the Background capability of my app. For the Bluetooth peripheral it looks fine and functional. The Bluetooth central part bring me into some problems. After putting the iOS Device into Sleep mode my event handlers are no more functional. Therefore I was also not able to check if Firebase functions works in background mode.
What I did till now is following:
- https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html I configurend the info.plist file and set up the Background functionalities of Bluetooth
- I tried to work with Background fetcg plugin for flutter. For Android I observed once I switch of the screen I can see that my for loop is still running. By enabling and disabling Background fetch periodically i can keep the for loop running in continues mode. When I try the same on iOS I can see that exactly after 30 seconds the for loop stops. Problem is at iOS also that the Background fetch event never gets fired when the Device switch to sleep mode. The event can only be triggered over Xcode function "Simulate Background Fetch".
I read that somehow with Flutter_isolate in combination with Background fetch can work. Do you have any ideas or hints how I can implement the Bluetooth central and Firebase functionality in the Background? Thank you!