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
Hello,
I'm using this plugging to run a function (bluetooth scan) in background, even if the app is not "open".
As a way to try this plugging to see if it fit my need, I code a very easy app where when I tap a button, it launch the bluetooth scan as a "forground service", and when the same button is tap again, it stop the scan and the foreground service.
A few second after closing the foreground service, I have the following warning on my console :
"E/PowerManager(14614): WakeLock finalized while still held: FlutterBackgroundPlugin:Wakelock"
Even though the app seems to work fine. When I tap pthe button I can see my bluetooth scan starting (it prints the snaned devices), and when I tap it again, I can see the foreground service stoping (notification disapearing), and the bluetooth scan stopping as well.
Have you aver have this error ? Can i just igniore it, or did I do someting wrong ?
I pasted bellow the way I'm using the plugging :
//Android Config
final androidConfig = FlutterBackgroundAndroidConfig(
notificationTitle: "My title",
notificationText: "Bluetooth Scan in process",
notificationImportance: AndroidNotificationImportance.Default,
notificationIcon: AndroidResource(name: 'icon_foregroundService.png', defType: 'drawable'),
);
//Function To start the foreground Service
void StartFGS() async {
bool hasPermissions = await FlutterBackground.hasPermissions;
bool success = await FlutterBackground.initialize(androidConfig: androidConfig);
await FlutterBackground.enableBackgroundExecution();
startBluetoothScan();
}
//Function to Stop The foreground service
void stopForegroundService() async{
stopScanForDevice();
//await FlutterBackground.initialize();
await FlutterBackground.disableBackgroundExecution();
}
//The following function is in another file, and is called when the button is tapped :
void _toggleForegroundServiceOnOff() async {
if (fgsIsRunning) {
stopForegroundService();
setState(() {
fgsIsRunning = false;
});
}
else {
maybeStartFGS();
setState(() {
fgsIsRunning = true;
});
}
}
Smartphone:
Device: Pixel 4 5G
The text was updated successfully, but these errors were encountered:
I'm still experiencing this warning with latest version, and in real samsung devices, it used 100% cpu and freeze hang the app, was that had anything to do with this?
Hello,
I'm using this plugging to run a function (bluetooth scan) in background, even if the app is not "open".
As a way to try this plugging to see if it fit my need, I code a very easy app where when I tap a button, it launch the bluetooth scan as a "forground service", and when the same button is tap again, it stop the scan and the foreground service.
A few second after closing the foreground service, I have the following warning on my console :
"E/PowerManager(14614): WakeLock finalized while still held: FlutterBackgroundPlugin:Wakelock"
Even though the app seems to work fine. When I tap pthe button I can see my bluetooth scan starting (it prints the snaned devices), and when I tap it again, I can see the foreground service stoping (notification disapearing), and the bluetooth scan stopping as well.
Have you aver have this error ? Can i just igniore it, or did I do someting wrong ?
I pasted bellow the way I'm using the plugging :
Smartphone:
The text was updated successfully, but these errors were encountered: