JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
89 stars 52 forks source link

[BUG] initialize() return false on Android TV, same problem not found on android phone #50

Open butterken opened 2 years ago

butterken commented 2 years ago

I am now developing application for android TV that needs background service. The following command return false when i run on android TV. The same problem doesn't exist on android phone.

final androidConfig = FlutterBackgroundAndroidConfig(
      notificationTitle: "Background Device Health Check",
      notificationText: "Notification for keeping the app running in the background",
      notificationImportance: AndroidNotificationImportance.Default,
      notificationIcon: AndroidResource(name: 'background_icon', defType: 'drawable'),
);
bool success = await FlutterBackground.initialize(androidConfig: androidConfig); // <- this one return false

There was no error show in console. I tested it on android studio, with the build-in emulator. I have tried android 8.1 and android 10 but both fail. I have go thought the forum for a solution, and i found that the notification config on android tv may not be the same as the one in android phone. Any solution for this issue?

image

JulianAssmann commented 2 years ago

Unfortunately, I currently have no Android TV available for testing and therefore also no experience with developing for it. So I need help to solve this problem.

butterken commented 2 years ago

I dont have Android TV either. I just use the buildin emulator of android studio to test. The result is that on phone emulator run smoothly but failed on TV emulator. After checking the console carefully, i find that FlutterBackground.initialize return false and thus, the program stop.

Unfortunately, I currently have no Android TV available for testing and therefore also no experience with developing for it. So I need help to solve this problem.

JulianAssmann commented 2 years ago

I'm currently not able to run an Android TV emulator, presumably because I'm on an Apple M1 Macbook. But if the plugin works under Android for Phones, there is probably some configuration error in some Manifest file.