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

If app is in background mode then entry and exit not working #3

Closed
sarishti opened this issue Jun 19, 2019 · 4 comments
Closed

If app is in background mode then entry and exit not working #3

sarishti opened this issue Jun 19, 2019 · 4 comments
Labels
Waiting for response Will be closed if now response

Comments

@sarishti
Copy link

sarishti commented Jun 19, 2019

If app is in background mode/ kill state then entry and exit not working in case of android

@michaelmika
Copy link
Owner

Do you mean the "Monitoring Geofence" or a "normal" Geofence? This library uses the native Geofencing abilities of the OS (See: Android or iOS. It's limited to the native's abilities (e.g. number of geofences, OS version, etc.). It is not the most accurate geofencing, but batterie saving and efficient, that's why it can sometimes take a bit to get the notification. Which OS are you using?

In case you mean the "Monitoring Geofence" check the Topic in the Docs (at the end) for it's implementation depending the OS.

@sarishti
Copy link
Author

I am using normal geofence and I am using OS version 9 on s8 device. In case of ios It is working fine during background mode and push me notification but in android it is not working.

@michaelmika
Copy link
Owner

michaelmika commented Jul 10, 2019

Have you enabled your device to let Apps use high (fine) accuracy location? See here.
This module does not ask if the permission is granted (because I had trouble in another Project with it). You might want to ask the user at the beginning of your App. It is pretty simple in React:

async function requestLocationPermission() {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
      {
        title: 'Location Permission for geofencing',
        message:
          'We need that permission for the geofencing feature',
        buttonNeutral: 'Ask Me Later',
        buttonNegative: 'Cancel',
        buttonPositive: 'OK',
      },
    );
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log('You can use the Location now');
    } else {
      console.log('Location permission denied');
    }
  } catch (err) {
    console.warn(err);
  }
}

see react docs

@michaelmika michaelmika added the Waiting for response Will be closed if now response label Aug 7, 2019
@ghost
Copy link

ghost commented Feb 2, 2020

I think after Oreo (Android 8) they don't let you do location stuff Inna back ground service and you have to start a foreground service with a notification. I might be wrong but it looks similar to this issue in another module which has a fork to fix it.

eddieowens/react-native-boundary#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for response Will be closed if now response
Projects
None yet
Development

No branches or pull requests

2 participants