-
Notifications
You must be signed in to change notification settings - Fork 372
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
Monitoring beacons with app closed - IOS #259
Comments
UPDATE- It automatically started to work. The app is closed, I didn't make any changes to plugin version or iOS and it suddenly started working. I left the phone next to the beacon and forgot about it for few minutes and I did see my application executing the code I had in region enter event. Once it started working it has been working consistently so after that..so far. I have tried it many times before over last few days and did not work. But the question is why it wasn't working before!? It's really strange! |
Hi, I'm facing exactly the same issue. I set up an environment which simply makes an http call to my server on didEnterRegion and didExitRegion events and I turn my ibeacon on/off every few minutes. In background mode it works for a couple of minutes (5-10), after that it stops making requests to my server and logging the events. However, in some cases it continued to work for hours at a time! Like @codingjam I'm running requestWhenInUseAuthorization and requestAlwaysAuthorization which asks the user permission, and I've got (most of) the Background Modes checked in Capabilities in XCode. Have you by any chance figured out what was causing iOS to stop calling the event handlers? This is the code I am using:
|
By background you mean app killed or the app is just pushed to the background by pressing home button? I was having trouble with Monitoring with app killed. It was working fine for me when the app is in background. And I still don't know why it started working. I just refreshed the app on my phone and it started working for me. Are you on iOS 10? I don't know what exactly are you facing, but people have reported some inconsistent behavior with ibeacon on ios 10 #254 |
Hi, I think I've managed to fix the issue. Make sure to place the code inside the .run function of app.js, or put it in a provider/service and call it from .run. This is essential as controllers are not properly loaded by ios when it starts in background mode. Previously I was loading the code from within the controller, but this fails intermittently. Now I'm able to scan for beacons even if I kill the app myself. After killing, it starts right up in the background in about 1-2 minutes. I'm using iOS 10.1.1 and version 3.4.1 (the latest) of this ibeacon plugin. |
hi, I cannot get iOS to run my delegate.didDetermineStateForRegion function upon that first startup in background. for testing I have set my app to only set the delegate ondeviceready so I am sure it is the fastest possible app you can have. but sure enough, after I kill the app, the first time I enter a region, nothing happens. second and third times happen like a charm because the app was already running in background and therefore had primed the delegate. #269 |
Make sure you wait about 1-2 minutes after you're entering/exiting the region or killing the app. Also check that you're placing the code inside the .run and not a controller, as controllers don't always init in the background mode. |
Great, yes if you were using Ionic (which uses Angular JS) by coincidence then that would be applicable, otherwise forget what I said :) |
Please check out v3.6.1, the latest release as of right now. |
I have seen many questions here related to this topic, but I haven't found an answer. This is a great plugin, it works as expected in foreground and background, but I can't get it to Monitor when app is closed. According to the Apple documentation, Monitoring for beacons is allowed in background and when app is killed/closed. When you kill the app, the iOS monitors for beacon regions that your app created and wakes up your app for few seconds in background when you enter/exit the beacon region. I have seen this working fine on Xamarin and native apps that I built before, but I can't get it work using this plugin on Cordova. The plugins documentation also says "Region Monitoring (or geo fencing), works in all app states." for IOS. I saw a couple of posts here where people said they were able to Monitor with app closed.
I have all the right permissions requestWhenInUseAuthorization and requestAlwaysAuthorization, Background App Refresh is on. I am also using local-notifications plugin. I am using the 3.4.1 version of this plugin and running iOS 10.0.2,
Here are other existing related issues I have looked into: #227 #224 #247
Can someone provide some direction on this? How can I get it to Monitor beacons with app closed on ios?
The text was updated successfully, but these errors were encountered: