Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Background actions #50

Open
hadare1 opened this issue Dec 18, 2019 · 3 comments
Open

Background actions #50

hadare1 opened this issue Dec 18, 2019 · 3 comments

Comments

@hadare1
Copy link

hadare1 commented Dec 18, 2019

Hi, I just received the starter kit and stetted up a play ground in react-native 0.61.5.

How exactly does the background mode works? I enabled the backround bluetooth in xCode and my I initialize the proximityObserver with this config:

const config = {
      notification: {
      title: 'Exploration mode is on',
      text: 'We\'ll notify you when you\'re next to something interesting.',
      channel: {
         id: 'exploration-mode',
        name: 'Exploration Mode',
      },
    },
 };

I stetted up remote notification (which I know works) but when the phone is locked I do not receive these notifications. this is my proximityObserver startObserving method:

 zone1.onChangeAction = async contexts => {
  console.log('zone1 onChange', contexts);

  if (contexts.length > 0) {
    try {
      const data = {
        'restaurantName':'demo',
        'channel': 'channel1',
      };
      const res = await axios.post(`${this.url}/beaconTestNotification`, data);
    } catch (e) {
      modalCompatibleAlert(e);
    }
  } else {
    const data = {
      'restaurantName': 'Exit Demo rest',
      'channel': 'yDBu1uyduacwjC1iDaR6kDuiZfE3',
    };
    const res = await axios.post(`${this.url}/beaconTestNotification`, data);
  }
};

this is not called when the phone is locked.
should I do anything else? am I missing something? I haven't notice any other configuration in the docs.

Thanks

@hadare1 hadare1 closed this as completed Dec 18, 2019
@hadare1 hadare1 reopened this Dec 18, 2019
@hadare1
Copy link
Author

hadare1 commented Dec 18, 2019

Okay so I figured I did not have the "always" on the location permissions on.
So I got it to work on Background mode but it does not work when app is closed.

is there any more configuration I need to do in order to make this work?

@nandorojo
Copy link

By background mode, do you mean when the app is not currently open but still running in the background?

@nbastoWM
Copy link

nbastoWM commented Jul 5, 2021

I'm also trying to detect beacons when the phone screen is off or when the app is minimized, but I can't see how can I ask for "always" location permission in iOS with this package.

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

No branches or pull requests

3 participants