Skip to content
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

"Location Services Activated" popups continuouslly in system tray. #83

Closed
ADARSHAGNIHOTRI opened this issue Jun 20, 2019 · 9 comments
Closed

Comments

@ADARSHAGNIHOTRI
Copy link

ADARSHAGNIHOTRI commented Jun 20, 2019

Hi sir,
As many times my getcurrentpostion called it pops up accordingly.
I have also used "usesignificantchangesonly:true" but its not stoping.

Your Environment

  • Plugin version:1.0.9
  • Platform: Android
  • OS version:Mac os
  • Device manufacturer / model:
  • Flutter info (flutter doctor):
  • Plugin config:
PASTE_YOUR_CODE_HERE

bg.BackgroundGeolocation.start();
// bg.BackgroundGeolocation.onLocation(_onLocation);
bg.BackgroundGeolocation.onMotionChange(_onMotionChange);
bg.BackgroundGeolocation.onActivityChange(_onActivityChange);
bg.BackgroundGeolocation.onProviderChange(_onProviderChange);
bg.BackgroundGeolocation.onConnectivityChange(_onConnectivityChange);
//bg.BackgroundGeolocation.onNotificationAction(_onNotificationAction);
bg.BackgroundGeolocation.ready(bg.Config(
// debug: true,
reset: true,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
desiredAccuracy: bg.Config.DESIRED_ACCURACY_NAVIGATION,
distanceFilter: 100,
// locationUpdateInterval: 5000,
stopOnTerminate: false,
// preventSuspend: true,
startOnBoot: true,
useSignificantChangesOnly: true,
// heartbeatInterval: 2
)).then((bg.State state) {
bg.BackgroundGeolocation.stop();
print('[ready] ${state.toMap()}');
setState(() {
_enabled = state.enabled;
_isMoving = state.isMoving;
});
}).catchError((error) {
print('[ready] ERROR: $error');
});

. getcurrentpostion method -->

 bg.BackgroundGeolocation.getCurrentPosition(
    ). then((bg.Location location) {
      print('adarshaaaaaa');
      widget.store.dispatch(new UpdateCurrentLocationAction(WrappLocation.fromLocation(location)));

      updateLocation(location.coords.latitude, location.coords.longitude);
      // Fluttertoast.showToast( msg: 'LOCATION UPDATING -$location');
    }).catchError((error) {
      print('[getCurrentPosition] ERROR: $error');
    });

Expected Behavior

"location services activated" poping continuouslly

Actual Behavior

should not behave like above.

Steps to Reproduce

Context

I have tried "useSignificantChangesOnly: true,"

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
@christocracy
Copy link
Member

That’s correct. #getCurrentPosition launches a foreground-service to ensure completion of the request.

@ADARSHAGNIHOTRI
Copy link
Author

then please give me an alternate to hit my updateLocation api without that popup.
actually it's frequency of that one(popup) is very high.

@christocracy
Copy link
Member

Why are you executing #getCurrentPosition at “high frequency”?

@ADARSHAGNIHOTRI
Copy link
Author

if ((state.profile.provider ?? false) && (state.profile.status ?? 1) > 1 ){
bg.BackgroundGeolocation.getCurrentPosition(
persist: false,
timeout:30
). then((bg.Location location) {
print('adarshaaaaaa');
widget.store.dispatch(new UpdateCurrentLocationAction(WrappLocation.fromLocation(location)));

      updateLocation(location.coords.latitude, location.coords.longitude);
      // Fluttertoast.showToast( msg: 'LOCATION UPDATING -$location');
    }).catchError((error) {
      print('[getCurrentPosition] ERROR: $error');
    });

This is the one i have to perform.Just a Profile condition checking.Suggest me if you get an idea.
thankyou.

@ADARSHAGNIHOTRI
Copy link
Author

Actually popup occurs wherever i call getcurrentPostion . So please give me atleast one solution for which "Location Service activated" should not occur.

@christocracy
Copy link
Member

So please give me atleast one solution for which "Location Service activated" should not occur.

There is no solution. You can edit the content of the notification as desired though with Notification config.

@nikhiljuneja
Copy link

I am also, getting the same issue @christocracy, it is very annoying to see it pop up very frequently in the system tray. Is there any way to minimize/limit the occurrence to 1 per day or something.

Otherwise, it will drive the user mad and user at the end may uninstall the app.

Please assist @christocracy

@christocracy
Copy link
Member

Otherwise, it will drive the user mad and user at the end may uninstall the app.

Why are you executing #getCurrentPosition so often as to see it "pop up very frequently"?

@christocracy
Copy link
Member

@nikhiljuneja Show me the config you're using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants