transistorsoft / cordova-plugin-background-fetch

Implements background fetching of data.
MIT License
295 stars 80 forks source link

Background Fetch does not run when the screen is locked on iOS #34

Closed mtoo020 closed 7 years ago

mtoo020 commented 7 years ago

How can I make it still run when the screen is locked? I just tested with the Sample App.

2016-06-21 20:55:06.639 BG Geo[3015:535192] ► getState 2016-06-21 20:55:08.025 BG Geo[3015:535192] ► getState 2016-06-21 20:55:08.025 BG Geo[3015:536207] ╔═════════════════════════════════════════════════ 2016-06-21 20:55:08.026 BG Geo[3015:536207] ║TSLocationManager ► Configure 2016-06-21 20:55:08.026 BG Geo[3015:536207] ╠═════════════════════════════════════════════════ 2016-06-21 20:55:08.027 BG Geo[3015:536207] ╟─ { stopOnTerminate = false; } 2016-06-21 20:55:22.449 BG Geo[3015:535192] ► SUSPEND (enabled? 1) ---- I pressed the sleep/wake button at this point to lock the screen ----

15 minutes passed and no background fetch event

---- I pressed the sleep/wake button at this point to wake the phone ---- 2016-06-21 21:19:02.983 BG Geo[3015:535192] - CDVBackgroundFetch onFetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 21:19:02.997 BG Geo[3015:535192] ║TSLocationManager ► Background Fetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► createBackgroundTask: 20 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► Motion-detector: ON 2016-06-21 21:19:05.345 BG Geo[3015:535192] [js] BackgroundFetch initiated 2016-06-21 21:19:05.348 BG Geo[3015:535192] - CDVBackgroundFetch finish 2016-06-21 21:19:05.349 BG Geo[3015:535192] - CDVBackgroundFetch stopBackgroundTask

christocracy commented 7 years ago

By definition, Background Fetch runs in the background (when, as you say, the screen is locked).

You can simulate background fetch in XCode.

On Tuesday, June 21, 2016, mtoo020 notifications@github.com wrote:

How can I make it still run when the screen is locked?

2016-06-21 20:53:19.612 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 20:53:19.613 BG Geo[3015:535192] ║TSLocationManager ► Configure 2016-06-21 20:53:19.613 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 20:53:19.615 BG Geo[3015:535192] ╟─ { activityRecognitionInterval = 10000; activityType = OtherNavigation; autoSync = true; batchSync = false; debug = true; deferTime = 0; desiredAccuracy = 0; disableElasticity = false; disableMotionActivityUpdates = false; distanceFilter = 20; fastestLocationUpdateInterval = 1000; forceReloadOnBoot = false; forceReloadOnGeofence = false; forceReloadOnHeartbeat = false; forceReloadOnLocationChange = false; forceReloadOnMotionChange = false; foregroundService = true; heartbeatInterval = 60; locationUpdateInterval = 5000; method = POST; params = { device = { available = 1; cordova = "4.1.1"; isVirtual = 0; manufacturer = Apple; model = "iPhone4,1"; platform = iOS; serial = unknown; uuid = "FE13F439-A8BC-40AC-B6A0-57CD83421BFD"; version = "9.3.2"; }; }; preventSuspend = false; startOnBoot = false; stationaryRadius = 20; stopDetectionDelay = 0; stopOnTerminate = true; stopTimeout = 1; triggerActivities = "in_vehicle, on_bicycle, running, walking, on_foot"; url = " http://posttestserver.com/post.php?dir=ionic-cordova-background-geolocation "; useSignificantChangesOnly = false; }

2016-06-21 20:55:22.449 BG Geo[3015:535192] ► SUSPEND (enabled? 1)

**---- I pressed the sleep/wake button at this point to lock the screen

15 minutes passed and no background fetch event

---- I pressed the sleep/wake button at this point to wake the phone ----** 2016-06-21 21:19:02.983 BG Geo[3015:535192] - CDVBackgroundFetch onFetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 21:19:02.997 BG Geo[3015:535192] ║TSLocationManager ► Background Fetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► createBackgroundTask: 20 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► Motion-detector: ON 2016-06-21 21:19:05.345 BG Geo[3015:535192] [js] BackgroundFetch initiated 2016-06-21 21:19:05.348 BG Geo[3015:535192] - CDVBackgroundFetch finish 2016-06-21 21:19:05.349 BG Geo[3015:535192] - CDVBackgroundFetch stopBackgroundTask

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/christocracy/cordova-plugin-background-fetch/issues/34, or mute the thread https://github.com/notifications/unsubscribe/AAA6l698mA4-nYln_8bK4XJjFTKan0Fyks5qN62-gaJpZM4I6hhS .

Snet form Gmail Mobile

mtoo020 commented 7 years ago

That's all true but background fetches aren't being processed on a device when the screen is locked, until it's unlocked.

Please could you load the sample app onto an actual iPhone, run it, tap the home button to suspend it, then lock the screen and leave it for half an hour. When you return, have a look on Xcode to see if two Background Fetches have been triggered. You'll probably see none or one. Unlock the phone and you'll see the Background Fetch suddenly appear.

If you get both Background Fetches processed, please reply with the configuration you used.

On Tuesday, 21 June 2016, Chris Scott notifications@github.com wrote:

By definition, Background Fetch runs in the background (when, as you say, the screen is locked).

You can simulate background fetch in XCode.

On Tuesday, June 21, 2016, mtoo020 <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

How can I make it still run when the screen is locked?

2016-06-21 20:53:19.612 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 20:53:19.613 BG Geo[3015:535192] ║TSLocationManager ► Configure 2016-06-21 20:53:19.613 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 20:53:19.615 BG Geo[3015:535192] ╟─ { activityRecognitionInterval = 10000; activityType = OtherNavigation; autoSync = true; batchSync = false; debug = true; deferTime = 0; desiredAccuracy = 0; disableElasticity = false; disableMotionActivityUpdates = false; distanceFilter = 20; fastestLocationUpdateInterval = 1000; forceReloadOnBoot = false; forceReloadOnGeofence = false; forceReloadOnHeartbeat = false; forceReloadOnLocationChange = false; forceReloadOnMotionChange = false; foregroundService = true; heartbeatInterval = 60; locationUpdateInterval = 5000; method = POST; params = { device = { available = 1; cordova = "4.1.1"; isVirtual = 0; manufacturer = Apple; model = "iPhone4,1"; platform = iOS; serial = unknown; uuid = "FE13F439-A8BC-40AC-B6A0-57CD83421BFD"; version = "9.3.2"; }; }; preventSuspend = false; startOnBoot = false; stationaryRadius = 20; stopDetectionDelay = 0; stopOnTerminate = true; stopTimeout = 1; triggerActivities = "in_vehicle, on_bicycle, running, walking, on_foot"; url = "

http://posttestserver.com/post.php?dir=ionic-cordova-background-geolocation "; useSignificantChangesOnly = false; }

2016-06-21 20:55:22.449 BG Geo[3015:535192] ► SUSPEND (enabled? 1)

**---- I pressed the sleep/wake button at this point to lock the screen

15 minutes passed and no background fetch event

---- I pressed the sleep/wake button at this point to wake the phone ----** 2016-06-21 21:19:02.983 BG Geo[3015:535192] - CDVBackgroundFetch onFetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 21:19:02.997 BG Geo[3015:535192] ║TSLocationManager ► Background Fetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► createBackgroundTask: 20 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► Motion-detector: ON 2016-06-21 21:19:05.345 BG Geo[3015:535192] [js] BackgroundFetch initiated 2016-06-21 21:19:05.348 BG Geo[3015:535192] - CDVBackgroundFetch finish 2016-06-21 21:19:05.349 BG Geo[3015:535192] - CDVBackgroundFetch stopBackgroundTask

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/christocracy/cordova-plugin-background-fetch/issues/34 , or mute the thread < https://github.com/notifications/unsubscribe/AAA6l698mA4-nYln_8bK4XJjFTKan0Fyks5qN62-gaJpZM4I6hhS

.

Snet form Gmail Mobile

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/christocracy/cordova-plugin-background-fetch/issues/34#issuecomment-227393596, or mute the thread https://github.com/notifications/unsubscribe/AE3k8uHR8ru6pJIw_cSRlCXO13CdctMsks5qN7RegaJpZM4I6hhS .

Cheers, Mark

christocracy commented 7 years ago

I see a stream of background fetch event notifications when I wake up in the morning.

On Tuesday, June 21, 2016, mtoo020 notifications@github.com wrote:

That's all true but background fetches aren't being processed on a device when the screen is locked, until it's unlocked.

Please could you load the sample app onto an actual iPhone, run it, tap the home button to suspend it, then lock the screen and leave it for half an hour. When you return, have a look on Xcode to see if two Background Fetches have been triggered. You'll probably see none or one. Unlock the phone and you'll see the Background Fetch suddenly appear.

If you get both Background Fetches processed, please reply with the configuration you used.

On Tuesday, 21 June 2016, Chris Scott <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

By definition, Background Fetch runs in the background (when, as you say, the screen is locked).

You can simulate background fetch in XCode.

On Tuesday, June 21, 2016, mtoo020 <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com'); <javascript:_e(%7B%7D,'cvml','notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');');>> wrote:

How can I make it still run when the screen is locked?

2016-06-21 20:53:19.612 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 20:53:19.613 BG Geo[3015:535192] ║TSLocationManager ► Configure 2016-06-21 20:53:19.613 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 20:53:19.615 BG Geo[3015:535192] ╟─ { activityRecognitionInterval = 10000; activityType = OtherNavigation; autoSync = true; batchSync = false; debug = true; deferTime = 0; desiredAccuracy = 0; disableElasticity = false; disableMotionActivityUpdates = false; distanceFilter = 20; fastestLocationUpdateInterval = 1000; forceReloadOnBoot = false; forceReloadOnGeofence = false; forceReloadOnHeartbeat = false; forceReloadOnLocationChange = false; forceReloadOnMotionChange = false; foregroundService = true; heartbeatInterval = 60; locationUpdateInterval = 5000; method = POST; params = { device = { available = 1; cordova = "4.1.1"; isVirtual = 0; manufacturer = Apple; model = "iPhone4,1"; platform = iOS; serial = unknown; uuid = "FE13F439-A8BC-40AC-B6A0-57CD83421BFD"; version = "9.3.2"; }; }; preventSuspend = false; startOnBoot = false; stationaryRadius = 20; stopDetectionDelay = 0; stopOnTerminate = true; stopTimeout = 1; triggerActivities = "in_vehicle, on_bicycle, running, walking, on_foot"; url = "

http://posttestserver.com/post.php?dir=ionic-cordova-background-geolocation

"; useSignificantChangesOnly = false; }

2016-06-21 20:55:22.449 BG Geo[3015:535192] ► SUSPEND (enabled? 1)

**---- I pressed the sleep/wake button at this point to lock the screen

15 minutes passed and no background fetch event

---- I pressed the sleep/wake button at this point to wake the phone ----** 2016-06-21 21:19:02.983 BG Geo[3015:535192] - CDVBackgroundFetch onFetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 21:19:02.997 BG Geo[3015:535192] ║TSLocationManager ► Background Fetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► createBackgroundTask: 20 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► Motion-detector: ON 2016-06-21 21:19:05.345 BG Geo[3015:535192] [js] BackgroundFetch initiated 2016-06-21 21:19:05.348 BG Geo[3015:535192] - CDVBackgroundFetch finish 2016-06-21 21:19:05.349 BG Geo[3015:535192] - CDVBackgroundFetch stopBackgroundTask

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <

https://github.com/christocracy/cordova-plugin-background-fetch/issues/34

, or mute the thread <

https://github.com/notifications/unsubscribe/AAA6l698mA4-nYln_8bK4XJjFTKan0Fyks5qN62-gaJpZM4I6hhS

.

Snet form Gmail Mobile

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/christocracy/cordova-plugin-background-fetch/issues/34#issuecomment-227393596 , or mute the thread < https://github.com/notifications/unsubscribe/AE3k8uHR8ru6pJIw_cSRlCXO13CdctMsks5qN7RegaJpZM4I6hhS

.

Cheers, Mark

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/christocracy/cordova-plugin-background-fetch/issues/34#issuecomment-227429021, or mute the thread https://github.com/notifications/unsubscribe/AAA6lzjEaINGqefrkyaLZl4cPWQM8-Pyks5qN92qgaJpZM4I6hhS .

Snet form Gmail Mobile

klyonrad commented 7 years ago

Unlock the phone and you'll see the Background Fetch suddenly appear.

iOS magically controls when background Fetch is executed, and the fact that it's executed when the user unlocks the phone (because now energy is drained anyway) is one of the intelligent mechanisms. You, as an app developer should not have to worry about when it's executed.

mtoo020 commented 7 years ago

Thanks for your replies.

Christocracy, what's your configuration? I've just cloned your sample app again, set preventSuspend to true and stopOnTerminate to false, but it still fails on both the device and simulator. The notifications you do see in the screenshot below are from me manually triggering a background fetch in Xcode. I was expecting to receive a background fetch notification every 15 minutes. On my device I just stop receiving Background Fetches after a while.

Kylonrad, here's why I'm trying to do this. Our app is part of a research study to track participants (who have consented to being tracked) to see how long they spend in buildings of interest and send them notifications while they're there. So I'd like to wake up the app every 15 minutes to check whether they're still there, and send them a notification if they are. Participants are likely to have their phone in their pocket with their screen locked. Christocracy keeps telling me the plugin will still process background fetches while the screen is locked, which is why I'm continuing to pursue this option.

no 15-minutely stream for me

mtoo020 commented 7 years ago

Please could you let me know your configuration.

Cheers, Mark

On 22 June 2016 at 01:52, Chris Scott notifications@github.com wrote:

I see a stream of background fetch event notifications when I wake up in the morning.

On Tuesday, June 21, 2016, mtoo020 notifications@github.com wrote:

That's all true but background fetches aren't being processed on a device when the screen is locked, until it's unlocked.

Please could you load the sample app onto an actual iPhone, run it, tap the home button to suspend it, then lock the screen and leave it for half an hour. When you return, have a look on Xcode to see if two Background Fetches have been triggered. You'll probably see none or one. Unlock the phone and you'll see the Background Fetch suddenly appear.

If you get both Background Fetches processed, please reply with the configuration you used.

On Tuesday, 21 June 2016, Chris Scott <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

By definition, Background Fetch runs in the background (when, as you say, the screen is locked).

You can simulate background fetch in XCode.

On Tuesday, June 21, 2016, mtoo020 <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com'); <javascript:_e(%7B%7D,'cvml','notifications@github.com

javascript:_e(%7B%7D,'cvml','notifications@github.com');');>> wrote:

How can I make it still run when the screen is locked?

2016-06-21 20:53:19.612 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 20:53:19.613 BG Geo[3015:535192] ║TSLocationManager ► Configure 2016-06-21 20:53:19.613 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 20:53:19.615 BG Geo[3015:535192] ╟─ { activityRecognitionInterval = 10000; activityType = OtherNavigation; autoSync = true; batchSync = false; debug = true; deferTime = 0; desiredAccuracy = 0; disableElasticity = false; disableMotionActivityUpdates = false; distanceFilter = 20; fastestLocationUpdateInterval = 1000; forceReloadOnBoot = false; forceReloadOnGeofence = false; forceReloadOnHeartbeat = false; forceReloadOnLocationChange = false; forceReloadOnMotionChange = false; foregroundService = true; heartbeatInterval = 60; locationUpdateInterval = 5000; method = POST; params = { device = { available = 1; cordova = "4.1.1"; isVirtual = 0; manufacturer = Apple; model = "iPhone4,1"; platform = iOS; serial = unknown; uuid = "FE13F439-A8BC-40AC-B6A0-57CD83421BFD"; version = "9.3.2"; }; }; preventSuspend = false; startOnBoot = false; stationaryRadius = 20; stopDetectionDelay = 0; stopOnTerminate = true; stopTimeout = 1; triggerActivities = "in_vehicle, on_bicycle, running, walking, on_foot"; url = "

http://posttestserver.com/post.php?dir=ionic-cordova-background-geolocation

"; useSignificantChangesOnly = false; }

2016-06-21 20:55:22.449 BG Geo[3015:535192] ► SUSPEND (enabled? 1) **---- I pressed the sleep/wake button at this point to lock the

screen

15 minutes passed and no background fetch event

---- I pressed the sleep/wake button at this point to wake the phone ----** 2016-06-21 21:19:02.983 BG Geo[3015:535192] - CDVBackgroundFetch onFetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╔═════════════════════════════════════════════════ 2016-06-21 21:19:02.997 BG Geo[3015:535192] ║TSLocationManager ► Background Fetch 2016-06-21 21:19:02.997 BG Geo[3015:535192] ╠═════════════════════════════════════════════════ 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► createBackgroundTask: 20 2016-06-21 21:19:03.002 BG Geo[3015:535192] ► Motion-detector: ON 2016-06-21 21:19:05.345 BG Geo[3015:535192] [js] BackgroundFetch initiated 2016-06-21 21:19:05.348 BG Geo[3015:535192] - CDVBackgroundFetch finish 2016-06-21 21:19:05.349 BG Geo[3015:535192] - CDVBackgroundFetch stopBackgroundTask

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <

https://github.com/christocracy/cordova-plugin-background-fetch/issues/34

, or mute the thread <

https://github.com/notifications/unsubscribe/AAA6l698mA4-nYln_8bK4XJjFTKan0Fyks5qN62-gaJpZM4I6hhS

.

Snet form Gmail Mobile

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/christocracy/cordova-plugin-background-fetch/issues/34#issuecomment-227393596

, or mute the thread <

https://github.com/notifications/unsubscribe/AE3k8uHR8ru6pJIw_cSRlCXO13CdctMsks5qN7RegaJpZM4I6hhS

.

Cheers, Mark

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/christocracy/cordova-plugin-background-fetch/issues/34#issuecomment-227429021 , or mute the thread < https://github.com/notifications/unsubscribe/AAA6lzjEaINGqefrkyaLZl4cPWQM8-Pyks5qN92qgaJpZM4I6hhS

.

Snet form Gmail Mobile

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/christocracy/cordova-plugin-background-fetch/issues/34#issuecomment-227446346, or mute the thread https://github.com/notifications/unsubscribe/AE3k8qlxygRfPDQS54nAfpyxlxKPrSuUks5qN-y7gaJpZM4I6hhS .

klyonrad commented 7 years ago

So I'd like to wake up the app every 15 minutes to check whether they're still there, and send them a notification if they are.

Sounds like this is the wrong plugin for yur use case if you rely on that specific time

mtoo020 commented 7 years ago

It doesn't have to be every 15 minutes, I just mean at all. @christocracy was saying that it's working for him, maybe I just need to wait longer. I'm using the premium version of cordova-background-geolocation, which depends on this plugin.

keithdmoore commented 7 years ago

I am using the cordova-background-geolocation plugin in addition to this backgroud-fetch plugin. I cant seen to get the background-fetch to ever call my app. Could it be that using both together is causing an issue? @mtoo020 what does your config for both look like? Had any luck with this?

christocracy commented 7 years ago

Yes, they work together. In fact, background-geolocation automatically includes background-fetch as a dependency since 1.6.0.

You should not manually install background fetch with background-geolocation.

Especially so, since I just posted a major refactor of background-fetch this weekend.

If you're manually including background-fetch, I suggest you completely uninstall both plugins and re-install background-geolocation.

keithdmoore commented 7 years ago

I get this on Android. I know you dont support Android in the background-fetch plugin. And I don't call it if I am running on Android.

08-07 11:39:12.114: D/PluginManager(22437): exec() call to unknown plugin: BackgroundFetch

christocracy commented 7 years ago

Yes, that's fine.

keithdmoore commented 7 years ago

So do I still configure the Fetcher as described in the README? Like this:

    Fetcher.configure(() => {
      console.log('iOS BackgroundService initiated');
      // Do my background stuff here and call finish.
      Fetcher.finish();
    }, error => {
      console.log('iOS BackgroundService failed', error);
    },{
        debug: true, // if true, should log and show notifications
        stopOnTerminate: false  // <-- true is default
      }
    );
christocracy commented 7 years ago

It optional. If you wish to do something in your app-code, go ahead. If not, the plugin uses the fetch API independently.

On Sunday, August 7, 2016, Keith D. Moore notifications@github.com wrote:

So do I still configure the Fetcher as described in the README? Like this:

Fetcher.configure(() => {
  console.log('iOS BackgroundService initiated');
  // Do my background stuff here and call finish.
  Fetcher.finish();
}, error => {
  console.log('iOS BackgroundService failed', error);
},{
    debug: true, // if true, should log and show notifications
    stopOnTerminate: false  // <-- true is default
  }
);

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238097578, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6lwmItodoHyIaWpzLREPdfbobkQdPks5qdhy-gaJpZM4I6hhS .

Snet form Gmail Mobile

keithdmoore commented 7 years ago

I am trying to do something, I just wanted to know if maybe I was missing how to configure the fetcher because I cant seem to get it to invoke. I never see my log (aka iOS BackgroundService initiated) statement in XCode when deploying to a device. I guess I will let it sit for several hours and see what happens.

christocracy commented 7 years ago

Did you do as I said, uninstall both plugins, then reinstall only latest version of background-geolocation?

On Sunday, August 7, 2016, Keith D. Moore notifications@github.com wrote:

I am trying to do something, I just wanted to know if maybe I was missing how to configure the fetcher because I cant seem to get it to invoke. I never see my log (aka iOS BackgroundService initiated) statement in XCode when deploying to a device.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238097795, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l6IoZdu9aEIDbnyPCLgljXeXbfrnks5qdh2jgaJpZM4I6hhS .

Snet form Gmail Mobile

keithdmoore commented 7 years ago

Yes sir, I did uninstall both plugins. Removed the platforms and re-added them. Brute force.

christocracy commented 7 years ago

Show me result of $ cordova plugins

On Sunday, August 7, 2016, Keith D. Moore notifications@github.com wrote:

Yes sir, I did uninstall both plugins. Removed the platforms and re-added them. Brute force.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238098000, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l4Vtwqgqde8KlehiZInUEGJMa2Unks5qdh5ygaJpZM4I6hhS .

Snet form Gmail Mobile

keithdmoore commented 7 years ago

Sorry, I just updated it....

com.transistorsoft.cordova.background-geolocation 2.0.5 "BackgroundGeolocation" cordova-custom-config 2.0.3 "cordova-custom-config" cordova-plugin-background-fetch 3.0.4 "CDVBackgroundFetch" cordova-plugin-background-mode 0.6.5 "BackgroundMode" cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-console 1.0.3 "Console" cordova-plugin-datepicker 0.9.2 "DatePicker" cordova-plugin-device 1.1.2 "Device" cordova-plugin-dialogs 1.2.1 "Notification" cordova-plugin-ios-no-export-compliance 0.0.1 "iOS No Export Compliance" cordova-plugin-listpicker 2.2.2 "ListPicker" cordova-plugin-network-information 1.2.1 "Network Information" cordova-plugin-screen-orientation 1.4.2 "Screen Orientation" cordova-plugin-splashscreen 3.2.2 "Splashscreen" cordova-plugin-sqlite-2 1.0.4 "SQLitePlugin" cordova-plugin-statusbar 2.1.3 "StatusBar" cordova-plugin-whitelist 1.2.2 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" phonegap-plugin-barcodescanner 5.0.1 "BarcodeScanner"

christocracy commented 7 years ago

$ cordova plugin remove cordova-plugin-background-fetch --force $ cordova plugin remove com.transistorsoft.cordova.background-geolocation

Reinstall background-geolocation

Show me again: $ cordova plugins

On Sunday, August 7, 2016, Keith D. Moore notifications@github.com wrote:

com.transistorsoft.cordova.background-geolocation 2.0.5 "BackgroundGeolocation" cordova-custom-config 2.0.3 "cordova-custom-config" cordova-plugin-background-fetch 3.0.4 "CDVBackgroundFetch" cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-console 1.0.3 "Console" cordova-plugin-datepicker 0.9.2 "DatePicker" cordova-plugin-device 1.1.2 "Device" cordova-plugin-dialogs 1.2.1 "Notification" cordova-plugin-ios-no-export-compliance 0.0.1 "iOS No Export Compliance" cordova-plugin-listpicker 2.2.2 "ListPicker" cordova-plugin-network-information 1.2.1 "Network Information" cordova-plugin-screen-orientation 1.4.2 "Screen Orientation" cordova-plugin-splashscreen 3.2.2 "Splashscreen" cordova-plugin-sqlite-2 1.0.4 "SQLitePlugin" cordova-plugin-statusbar 2.1.3 "StatusBar" cordova-plugin-whitelist 1.2.2 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" phonegap-plugin-barcodescanner 5.0.1 "BarcodeScanner"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238098147, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l7sIm1ay9cSFQ8wFE3aGOOxKJWKiks5qdh8NgaJpZM4I6hhS .

Snet form Gmail Mobile

keithdmoore commented 7 years ago

Looks like that pulled in a new version of background-fetch. Likely my issue, eh?

com.transistorsoft.cordova.background-geolocation 2.0.5 "BackgroundGeolocation" cordova-custom-config 2.0.3 "cordova-custom-config" cordova-plugin-background-fetch 4.0.0 "CDVBackgroundFetch" cordova-plugin-background-mode 0.6.5 "BackgroundMode" cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-console 1.0.3 "Console" cordova-plugin-datepicker 0.9.2 "DatePicker" cordova-plugin-device 1.1.2 "Device" cordova-plugin-dialogs 1.2.1 "Notification" cordova-plugin-ios-no-export-compliance 0.0.1 "iOS No Export Compliance" cordova-plugin-listpicker 2.2.2 "ListPicker" cordova-plugin-network-information 1.2.1 "Network Information" cordova-plugin-screen-orientation 1.4.2 "Screen Orientation" cordova-plugin-splashscreen 3.2.2 "Splashscreen" cordova-plugin-sqlite-2 1.0.4 "SQLitePlugin" cordova-plugin-statusbar 2.1.3 "StatusBar" cordova-plugin-whitelist 1.2.2 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" phonegap-plugin-barcodescanner 5.0.1 "BarcodeScanner"

christocracy commented 7 years ago

Try it now. Debug->Simulate background fetch

On Sunday, August 7, 2016, Keith D. Moore notifications@github.com wrote:

Looks like that pulled in a new version of background-fetch. Likely my issue, eh?

com.transistorsoft.cordova.background-geolocation 2.0.5 "BackgroundGeolocation" cordova-custom-config 2.0.3 "cordova-custom-config" cordova-plugin-background-fetch 4.0.0 "CDVBackgroundFetch" cordova-plugin-background-mode 0.6.5 "BackgroundMode" cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-console 1.0.3 "Console" cordova-plugin-datepicker 0.9.2 "DatePicker" cordova-plugin-device 1.1.2 "Device" cordova-plugin-dialogs 1.2.1 "Notification" cordova-plugin-ios-no-export-compliance 0.0.1 "iOS No Export Compliance" cordova-plugin-listpicker 2.2.2 "ListPicker" cordova-plugin-network-information 1.2.1 "Network Information" cordova-plugin-screen-orientation 1.4.2 "Screen Orientation" cordova-plugin-splashscreen 3.2.2 "Splashscreen" cordova-plugin-sqlite-2 1.0.4 "SQLitePlugin" cordova-plugin-statusbar 2.1.3 "StatusBar" cordova-plugin-whitelist 1.2.2 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" phonegap-plugin-barcodescanner 5.0.1 "BarcodeScanner"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238098639, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l2MDxZYXWCD8OuS_HQMfKZGkaC-Bks5qdiEQgaJpZM4I6hhS .

Snet form Gmail Mobile

keithdmoore commented 7 years ago

Sweet! It worked. Now to try on an actual device. Thank you so much for your help.

keithdmoore commented 7 years ago

When I deployed to a device, I tried the Debug->Simulate background fetch and that worked. However, a background fetch never gets issued by the OS. It's been about 2 hours now. Seems like I should have got one by now. Note: I am not locking the screen and the app is not in the foreground.

christocracy commented 7 years ago

Works consistently for me every 15 min, each day, every day. It's totally up to apple to fire the event.

The only thing the plugin does is turn the switch ON.

On Sunday, August 7, 2016, Keith D. Moore notifications@github.com wrote:

When I deployed to a device, I tried the Debug->Simulate background fetch and that worked. However, a background fetch never gets issued by the OS. It's been about 2 hours now. Seems like I should have got one by now. Note: I am not locking the screen and the app is not in the foreground.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238106234, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l9jOgwl8sZuQn4750EzJv55RyWjdks5qdj9FgaJpZM4I6hhS .

Snet form Gmail Mobile

christocracy commented 7 years ago

If it works in the sim, my job is done

On Sunday, August 7, 2016, Chris Scott christocracy@gmail.com wrote:

Works consistently for me every 15 min, each day, every day. It's totally up to apple to fire the event.

The only thing the plugin does is turn the switch ON.

On Sunday, August 7, 2016, Keith D. Moore <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

When I deployed to a device, I tried the Debug->Simulate background fetch and that worked. However, a background fetch never gets issued by the OS. It's been about 2 hours now. Seems like I should have got one by now. Note: I am not locking the screen and the app is not in the foreground.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-plugin-background-fetch/issues/34#issuecomment-238106234, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l9jOgwl8sZuQn4750EzJv55RyWjdks5qdj9FgaJpZM4I6hhS .

Snet form Gmail Mobile

Snet form Gmail Mobile

keithdmoore commented 7 years ago

The problem was between my phone and the floor. I didn't realize it but I had Background App Refresh turned off on my phone. It's working now! Thanks for all of your help.