rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
287 stars 321 forks source link

Callback* not triggered #301

Open 3wer3wer opened 2 years ago

3wer3wer commented 2 years ago

After the update from 1.6.6 to 1.6.12 I am facing the problem that the Callback-print* (see below) is not triggered even if the plugin is running.

I receive the message: D/plugin (4622): sendLocationEvent... but the listener is not triggered to update the UI. I tested with 2 devices and 2 emulators. Maybe I forgot to update something in the AppDelegate.swift and build.gradle.

I am pretty new to flutter. Sorry if I forget something obvious!

Thank you in advance and have a nice week.

* Future callback(LocationDto locationDto) async { print('$_count location in dart: ${locationDto.toString()}'); await setLogPosition(_count, locationDto); final SendPort? send = IsolateNameServer.lookupPortByName(isolateName); send?.send(locationDto); _count++; }

nick1377 commented 2 years ago

Same. Looks like the code is throwing a Null is not a String error because the provider in the location json is missing.

rulefahd commented 2 years ago

true++++++++++

AndroidDev68 commented 2 years ago

same problem

n0tc0ding commented 2 years ago

same problem

justjcool commented 2 years ago

Same problem

frankvollebregt commented 2 years ago

Same. Looks like the code is throwing a Null is not a String error because the provider in the location json is missing.

I made a fork where I set it to an empty String by default, which seems to indeed solve the issue.

dependency_overrides:
  background_locator:
    git:
      url: git@github.com:frankvollebregt/background_locator.git
      ref: location-dto-null-fix

It should probably be included in the actual JSON instead, but for now this might help

CristianKoh1 commented 2 years ago

I solved it in the following way image

frankvollebregt commented 2 years ago

Similar to what I did, I used a slightly shorter notation to do the same thing

...
json[Keys.ARG_PROVIDER] ?? '',
santa112358 commented 2 years ago

@SaeedMasoumi @easazade @payam-zahedi This package does not work on latest version. We all need to use the forked branch at the moment. Please solve this issue as soon as possible, as it seems critical and will not take much time to fix.

Thank you.

payam-zahedi commented 2 years ago

@santa112358 It seems that this package has not maintained for a long time. I will work on this package this weekend.

payam-zahedi commented 2 years ago

@santa112358 @frankvollebregt @CristianKoh1 seems we have open PR that worked on this issue.

317

I think this will solve the problem.

frankvollebregt commented 2 years ago

Yeah, there are a few PRs open that could resolve this. It's up to you to pick which one you like best I guess. While you're taking a look, fixing the warnings caused by Flutter 3.0 is probably a good idea too :D

Thanks for putting in the time to fix it