DSRCorporation / flutter-background-executor

Apache License 2.0
5 stars 2 forks source link

Struggling to test the example app... #11

Open millerf opened 1 year ago

millerf commented 1 year ago

Thanks a lot for the awesome work!

I have been trying a couple of solutions to get a a small task to send the phone's GPS location to my backend, and yours seems to be the most advanced / with less weird configuration.

However, I haven't been able to get any of those (including yours) to work.

From a brand new Flutter project, using the example main.dart and following the installation process, I cannot get any background task to show anything...

I must be missing something but I cannot figure out why.

ios

I checked your repo and opened your example/ app, and compiled. This is what I get (same on an Android physical device):

Screenshot 2023-02-23 at 17 27 28

It looks like I have the right capabilities set:

Screenshot 2023-02-23 at 17 29 48

Also, I get this in the terminal:

Upgrading Info.plist
Removing script build phase dependency analysis.
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Running pod install...
Running Xcode build...
Xcode build done.                                           29.9s
Debug service listening on ws://127.0.0.1:58718/bEmS5JoxNMY=/ws
Syncing files to device iPhone 14 Pro Max...
flutter: To simulate the refresh task you can use next command: "e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.dsr_corporation.task1"]"

But I have no idea what the command does, and if I run it I get:

$> e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"taskID"]

zsh: bad pattern: (void)[[BGTaskScheduler

Any idea?

Android

I got it working and I could see the task sending messages in the terminal, however as soon as I closed my app, the task seemed to terminate:


I/flutter (23101): refresh 0:00:19.164256
I/flutter (23101): refresh 0:00:20.179155
I/flutter (23101): end refresh task
I/WM-WorkerWrapper(23101): Worker result SUCCESS for Work [ id=1d39c6a7-db71-453e-a796-ed6078505dc2, tags={ com.dsr_corporation.flutter_background_executor.workers.FlutterBackgroundExecutorWorker } ]

So I could not have it run in the background...

Am I missing something?

millerf commented 1 year ago

I think I figured something out.

The "immediate tasks" are working perfectly in the background.

However I am more interested in the "refresh" tasks. And I cannnot get those to work...