Closed IKRAMULHAQ786 closed 1 year ago
@tulioccalazans
I'm also facing the same issue. Is there any breakthrough @IKRAMULHAQ786
Yes Actually, instead of writing the code in the listner, I wrote my API calling code in the Callback method. it works like a charm. if you want to do something when the app is terminated, you should write that part of code in callback method located in location_service_repository.dart file
Hello, I have two applications and I'm not having these kind of problems. Everything works perfectly.
@revrkk @IKRAMULHAQ786
Do you have any source code that I can analyze to try to help you?
Sir as I mentioned earlier, I just copied the example project files and just wrote the code in port.listen();
where I tried to call the api every 10 mintues and send the location updates to the server.
But As soon As I terminate the app, the API is never called in the backgraound and server doesn't receive any updates.
then I called the api from callback method whch is in location_service_repository.dart file of Example project and now it works
I didn't know where to write the code according to my scenario. I suppose they should have mentioned that how and where can we write our own code to handle the location updates
I configured my project using example project and then customizing according to my scenario. My Scenario: Location is updates every 1 minute and is saved into a list. when the list entries == 10, (after every 10 minutes), the API is called which sends those 10 location coordinates to the database.
Problem: When app gets terminated, the location service is still running as I can see location icon & sticky notification but it does not receives new location updates and eventually API is not called.
Pubspec.yaml fluttertoast: ^8.2.2 shared_preferences: ^2.1.1 get: ^4.6.5 http: ^1.0.0 flutter_spinkit: ^5.2.0 background_locator_2: ^2.0.6 path_provider: ^2.0.15 location_permissions: ^4.0.1
Code Snippet where I did some customizations for my scenario, the rest of the code is same as Example project.
port.listen( (dynamic data) async { await updateUI(data);