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

Question #6

Closed
machard opened this issue Sep 7, 2015 · 6 comments
Closed

Question #6

machard opened this issue Sep 7, 2015 · 6 comments

Comments

@machard
Copy link

machard commented Sep 7, 2015

Hi,

I have a doubt about something :
I see it is possible to set up event listeners in the JS code but i was wondering if they would be triggered when the app is not open or when the phone is sleeping.
According to facebook/react-native#1282, i am not so sure :/
What is your experience about it?

Thank you

@christocracy
Copy link
Member

That doesn't apply here since the plugin uses a UIBackgroundMode
"location", granting the app permission for continuous background running
(while the plugin is in "active state"; ie: while device is moving)

The plugin has a "passive, stationary state", where it turns off continuous
updates. In this case, what that link says does apply, where as soon as
the app is put in background, iOS immediately suspends the app.

I know exactly how iOS operates in these situations. This module is not
new. It was born in the Cordova universe over 2 years ago
attracting thousands of users.

On Monday, September 7, 2015, Matthieu Achard [email protected]
wrote:

Hi,

I have a doubt about something :
I see it is possible to set up event listeners in the JS code but i was
wondering if they would be triggered when the app is not open or when the
phone is sleeping.
According to facebook/react-native#1282
facebook/react-native#1282, i am not so sure
:/
What is your experience about it?

Thank you


Reply to this email directly or view it on GitHub
#6
.

Snet form Gmail Mobile

@christocracy
Copy link
Member

I should add, that while the plugin is in stationary state, it keeps a
stationary-geofence monitored, as well as iOS significant changes API
running.

These APis are allowed by iOS to awaken a suspended app when an event
occurs. My module uses these events as a switching mechanism, toggling to
the active-state.

On Monday, September 7, 2015, Chris Scott [email protected] wrote:

That doesn't apply here since the plugin uses a UIBackgroundMode
"location", granting the app permission for continuous background running
(while the plugin is in "active state"; ie: while device is moving)

The plugin has a "passive, stationary state", where it turns off
continuous updates. In this case, what that link says does apply, where as
soon as the app is put in background, iOS immediately suspends the app.

I know exactly how iOS operates in these situations. This module is not
new. It was born in the Cordova universe over 2 years ago
attracting thousands of users.

On Monday, September 7, 2015, Matthieu Achard <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

Hi,

I have a doubt about something :
I see it is possible to set up event listeners in the JS code but i was
wondering if they would be triggered when the app is not open or when the
phone is sleeping.
According to facebook/react-native#1282
facebook/react-native#1282, i am not so sure
:/
What is your experience about it?

Thank you


Reply to this email directly or view it on GitHub
#6
.

Snet form Gmail Mobile

Snet form Gmail Mobile

@machard
Copy link
Author

machard commented Sep 7, 2015

  • Ok so i understand that when the app goes in background I should disable the "passive, stationary state" to keep it running. is it possible ?
  • When i use stopOnTerminate: false and i exit the app i understand events will still be fired by the system and catched by your obj-c plugin. Then you will fire an event to the JS though RN bridge.
    So i can be confident that React Native will restore the bridge allowing the JS code to run the registered callbacks ? (this link may represent better what my interrogation is : [Bridge] Support background restoration facebook/react-native#1660).

@christocracy
Copy link
Member

  • Ok so i understand that when the app goes in background I should
    disable the "passive, stationary state" to keep it running. is it possible ?

Very bad idea. You will kill the battery in a few hours. And unless
you're making an app that requires bg tracking (eg: fleet tracking app,
fitness app) Apple will deny your app.

So i can be confident that React Native will restore the bridge allowing

the JS code to run the registered callbacks ? (this link may represent
better what my interrogation is : facebook/react-native#1660
facebook/react-native#1660).

That I don't know. That a framework problem.


Reply to this email directly or view it on GitHub
#6 (comment)
.

Snet form Gmail Mobile

@machard
Copy link
Author

machard commented Sep 7, 2015

Ok thank you.
Yes indeed I was questionning the framework more than what you did. As you already played with both background geo loc and react native i thought i would ask.

Ok i misread, I just need to know changes so passive state is enough. But i guess you confirmed me that the framework issue i am questionning is really an issue both when the app is in background and when the app has been closed.

@christocracy
Copy link
Member

It's not that bg tracking is allowed when app is closed, it's that iOS
persists geofence & significant changes monitoring in spite of app being
"closed".

An iOS app is never really "closed" in the strict sense.

Again, if an event occurs on these 2 APIs, iOS will awaken the app the
receive the event. My plugin uses these events as a mechanism to change
state to "active monitoring"

On Monday, September 7, 2015, Matthieu Achard [email protected]
wrote:

Ok thank you.
Yes indeed I was questionning the framework more than what you did. As you
already played with both background geo loc and react native i thought i
would ask.

However i don't understand why the bg tracking is allowed when the app is
closed but not when it is in background ?


Reply to this email directly or view it on GitHub
#6 (comment)
.

Snet form Gmail Mobile

Lida pushed a commit to livecirrus/react-native-background-geolocation that referenced this issue Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants