-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update location to my server after every 30 min automatically in kill state #84
Comments
You should implement flutter_background_fetch, already included as a dependency. Execute |
I have done this but still didn't get anything worthy------>>>>> BackgroundFetch.configure(BackgroundFetchConfig(
minimumFetchInterval: 15,
startOnBoot: true,
stopOnTerminate: false,
enableHeadless: true
), () async {
print('[BackgroundFetch] received event');
print('eeee');
bg.BackgroundGeolocation.getCurrentPosition(samples: 1).then((bg.Location location){
widget.store.dispatch(new UpdateCurrentLocationAction(WrappLocation.fromLocation(location)));
updateLocation(location.coords.latitude, location.coords.longitude);
});
BackgroundFetch.finish();
});
void backgroundFetchHeadlessTask() async {
print('[BackgroundFetch] Headless event received.');
bg.BackgroundGeolocation.getCurrentPosition().then((bg.Location location){
updateLocation(location.coords.latitude, location.coords.longitude);
print('background fetch succesful');
});
BackgroundFetch.finish();
}
void main() {
final store = new Store<GlobalAppStore>(appStateReducer, initialState: new GlobalAppStore(new Profile(), null, new List<TefillinWrapp>(), null, null, null));
final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
//LocationPicker.initApiKey(globals.GOOGLE_MAPS_API_KEY);
runApp(new TefillinWrappStore(store: store, firebaseMessaging: _firebaseMessaging,));
BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask);
} |
my app stop working after killing my app after some time. |
So my code is ok or not to fetch location in kill state? |
Yes. |
Is it because i am using debug mode? |
However, you should |
No |
Is there any other method to solve my problem?(updaing location in kill state with some interval) |
It is samsung s6 |
And you're simulating background fetch events, as directed in the background_fetch README? |
I have added Application.java file according to background geolocation plugin which is differ to background fetch android setup.So does it effect the functionality? |
Is it necessary? |
If you want to be an efficient developer and test the functionality in seconds instead of waiting 15 minutes, yes. |
What about this sir? |
Ok sir, Point to be noted. Thankyou for advice. |
Still not working Don't know what to do now? |
When i run this command in kill state then this appears----->>> ADARSHs-Mac-mini:platform-tools adarshagnihotri$ ./adb shell cmd jobscheduler run -f com.lightuptheworld.tefillinwrap 999 |
My Application.java file---->>>> import io.flutter.app.FlutterApplication; import com.transistorsoft.flutter.backgroundgeolocation.FLTBackgroundGeolocationPlugin; public class Application extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback { @OverRide |
Are you not actually watching $ adb logcat, as directed in the README? |
I want to send my location to my server after every 30 min automatically in kill state.
Your Environment mac
flutter doctor
):PASTE_YOUR_CODE_HERE
bg.BackgroundGeolocation.getCurrentPosition(
Expected Behavior
there should be a reasonable interval for which it execute in forground, backgound and kill state.
Actual Behavior
Dont have any interval for execution neither i got anything to control its execution.
Steps to Reproduce
Context
Debug logs
Logs
The text was updated successfully, but these errors were encountered: