-
Notifications
You must be signed in to change notification settings - Fork 319
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
iOS montioring when the app is killed/in background mode does not work #57
Comments
I did try to add: Also, I now get the following warning:
|
Thank you @oferRounds for this detailed issue. Master branch contains a merged PR to try to fix these inconsistencies in iOS (drop of Would you give a try (hoping it solves it)? Get master branch version: npm install git+https://github.com/MacKentoch/react-native-beacons-manager.git |
I think the issue here is a typo. Check the spelling of background in the method you are calling!
… On 16 Oct 2017, at 00:43, Erwan DATIN ***@***.***> wrote:
Thank you @oferRounds for this details issue.
Master branch contains a merged PR to try to fix these inconsistencies in iOS (drop of DeviceEventEmitter in favor of Beacons.BeaconsEventEmitter: see CHANGELOG).
Would you give a try (hoping it solves it)?
Get master branch version:
npm install git+https://github.com/MacKentoch/react-native-beacons-manager.git
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@MacKentoch - thanks! Do you mean it suppose to suppose to solve the background/app killed issue? @eurobob - oh, you’re right! Sorry for this :( |
@oferRounds I was having issues with detection when the app is killed but have been having much more consistent behaviour with a small addition to the library. Try the code from my pull request and see how it works: Be aware that you should be able to detect when monitoring and ranging is working, but if you are in range of the beacon when starting the app you will not trigger the entry event from monitoring. I'm trying to find a workaround for this now. |
Replied directly on issue #58. So it now does works great for me in the background/foreground, but not when the app is killed. The problems are the app either only wakes up once, when it enters the region (i.e., I would like to have the control to detect the proximity and only do something on an @eurobob I saw some posts that mention that when the app wakes up, in the |
@MacKentoch - I did the update, but I get the error: Any idea? |
Can you share more code from the file you're working in? |
Thanks! Sure:
|
It sounds like you might still be using v1.0.7? Or are you installing the package directly from the git repository? |
I followed your suggestion and installed it by: |
I'm not sure what could be the problem then. Just to be thorough, maybe unlink it and uninstall the npm package, then try again? You can also use my fork to include this pull request:
|
That’s an idea! I’ll do that. |
@oferRounds going back to the initial problem, i've found that in debugging mode sometimes the app can take a long time to load (bad wifi or whatever), which eats into the time window allocated to take action on the region entry from the monitoring. Perhaps you could try a production build to see if it works that way? |
We had the same problem. Adding maybe some function like RCT_EXPORT_METHOD(allowsBackgroundLocationUpdates:(BOOL)allow)
{
self.locationManager.allowsBackgroundLocationUpdates = allow;
} would be helpful. This would allow the developer to control, when ranging in background really needed. |
Thank you @sign2k for sharing. This is definitely a good fix to add. |
As suggested by @sign2k, I added: /**
* set background location updates to ensure monitoring when app is killed or in background mode
*
* @param {boolean} [allow=false] allow or disallow background modes
*/
function allowsBackgroundLocationUpdates(allow: boolean = false): void {
BeaconsManager.allowsBackgroundLocationUpdates(allow);
} Please note this requires iOS9+ (it should not be a problem, since iPhone owners should be at iOS10 for more than 90%) |
I’m facing the issue also in Android. I.e, on both platform, when the app is killed, the beacon is sometimes not detected and the app is not woken up. Otherwise — when in foreground or background - it works great. Two questions please:
|
@eurobob any findings perhaps from your tests? |
On iOS - I just added the code to AppDelegate.m according to Estimote guide, and now it works! Even when the app was killed by the user.
Do we want to address this in the library? |
As for Android, I see in Estimote docs that the following scenario is indeed not handled
Any idea for a workaround? |
I see that Estimote added this feature in their new coming up SDK. See here: https://forums.estimote.com/t/alpha-4-monitoring/7516 And here: Estimote/Android-Fleet-Management-SDK#62 (comment) Can we add something like this here also? What do you think? |
Hi All, I enabled background update by setting BeaconsManager.allowsBackgroundLocationUpdates(true) in the beginning of componentWillMount I would like to know if this suppose to work for only single region or multi region as I noticed when I am sending ranging information from multi region I will only get one region update instead of all of it. Thank you :D |
@MacKentoch , i tried v1.1 and background scanning not work. (i am in debug mode) do you have any idea? version: Source: import React, { Component } from 'react'; const instructions = Platform.select({ type Props = {}; } componentDidMount() {
); this.regionDidExitEvent = Beacons.BeaconsEventEmitter.addListener( render() { const styles = StyleSheet.create({ |
I just solve it by change the privacy. |
I was not able to see ranging in the background until I found your post. Thank you fine sir, this is exactly what I needed! |
@oferRounds , can you show me what code did you use in your AppDelegate? Because I think you have pasted the one from Estimote but the needed for this library will be different. Thanks! |
Version
1.0.7
Platform
iOS
OS version
iOS 11.0.2
Steps to reproduce
Expected behavior
Beacon should be detected also when the app is killed/in background mode
Actual behavior
The listener callback does not get called (it does get called on foreground)
The text was updated successfully, but these errors were encountered: