Git Product home page Git Product logo

Comments (10)

 avatar commented on June 19, 2024 2

Aaaaah! It is the App Target!

NSLocationAlwaysUsageDescription is for IOS 10+ I had IOS 8 set and removing this fixed the issue. But then also changing my target fixed it also.

from background_locator.

gpibarra avatar gpibarra commented on June 19, 2024

The library does not ask for permissions. Permissions should be asked in the main app(for example package location_permissions/location_permissions.
You did this?
https://github.com/rekab-app/background_locator/blob/86ef3a83714f9f2dc0e19f4fa711e39d6e2789f3/example/lib/main.dart#L174

from background_locator.

wemersonrv avatar wemersonrv commented on June 19, 2024

The library does not ask for permissions. Permissions should be asked in the main app(for example package location_permissions/location_permissions.
You did this?
https://github.com/rekab-app/background_locator/blob/86ef3a83714f9f2dc0e19f4fa711e39d6e2789f3/example/lib/main.dart#L174

Yes i do. see my code:

@override
  Widget build(BuildContext context) {
    if (!isRunning && isBackgroundActive) {
      _checkLocationPermission();
    }

    return OKToast(
      duration: Duration(seconds: Helpers.toastDuration),
      position: ToastPosition.bottom,
      handleTouth: true,
      dismissOtherOnShow: true,
      child: Visibility(
        visible: (linkFetch == true),

        ...


  void _checkLocationPermission() async {
    final access = await LocationPermissions().checkPermissionStatus();
    switch (access) {
      case PermissionStatus.unknown:
      case PermissionStatus.denied:
      case PermissionStatus.restricted:
        final permission = await LocationPermissions().requestPermissions(
          permissionLevel: LocationPermissionLevel.locationAlways,
        );
        if (permission == PermissionStatus.granted) {
          _startLocator();
        } else {
          // show error
        }
        break;
      case PermissionStatus.granted:
        _startLocator();
        break;
    }
  }

  void _startLocator() {
    BackgroundLocator.registerLocationUpdate(
      LocationBackground.callback,
      androidNotificationCallback: LocationBackground.notificationCallback,
      settings: LocationSettings(
        notificationTitle: "My App",
        notificationMsg: "My App Title",
        notificationIcon: 'ic_background',
        wakeLockTime: 20,
        autoStop: false,
        interval: 60 * 5, // 5 minutes (300 secs)
      ),
    );
    setState(() {
      isRunning = true;
    });
  }

It works on android, and ask for permission... see:
image

But in iOS do not ask for permission, and the location permission is missing in permission list in app detail. See here:

image

from background_locator.

mehdok avatar mehdok commented on June 19, 2024

Did you followed the instruction for setting up on iOS ?

You have to add location permission in Info.plist

from background_locator.

wemersonrv avatar wemersonrv commented on June 19, 2024

Did you followed the instruction for setting up on iOS ?

You have to add location permission in Info.plist

Yes i do!

When i opened this post i add the Info.plist portion that has backgrond location settings... I thing i do not miss any setting...

from background_locator.

gpibarra avatar gpibarra commented on June 19, 2024

Did you try running exactly the "example" from this repository? The Info.plist configuration looks good, but maybe there is something that the configuration is different.
If you try the "example" and it requires the permissions, we discard that it is not a problem of the library, but some missing documentation for the correct configuration.

from background_locator.

wemersonrv avatar wemersonrv commented on June 19, 2024

Works the example and works... weird... will investigate if something is missing here on my project.

But, in the repo "example" project is causing the same problem of this issue #55 (comment)_

from background_locator.

gpibarra avatar gpibarra commented on June 19, 2024

try with the previous version of the repo, maybe there is something in the configuration that is missing (in that case better the documentation). Then we go back to the latest version of the library and wait to solve the bug

from background_locator.

 avatar commented on June 19, 2024

I have the same issue

from background_locator.

mehdok avatar mehdok commented on June 19, 2024

I think this problem is fixed, so I'm closing this issue, but feel free to open it anytime;

from background_locator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.