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

Android Version #60

Closed
vinicri opened this Issue Apr 21, 2017 · 10 comments

Comments

Projects
None yet
5 participants
@vinicri

vinicri commented Apr 21, 2017

Chris,

I'm trying to do an Android version, is it possible to publish the code of TSBackgroundFetch.framework to get a better understand of how the fetch is managed?

Thanks

@christocracy

This comment has been minimized.

Show comment
Hide comment
@christocracy

christocracy Apr 21, 2017

Member

How do you propose to do an Android version?

Member

christocracy commented Apr 21, 2017

How do you propose to do an Android version?

@epetre

This comment has been minimized.

Show comment
Hide comment
@epetre

epetre May 2, 2017

Couldn't it be a background service that gets scheduled every X minutes just to fetch an info from the server and then shut down while rescheduling for X minutes later?

http://stackoverflow.com/questions/19652778/running-a-task-every-few-hours

epetre commented May 2, 2017

Couldn't it be a background service that gets scheduled every X minutes just to fetch an info from the server and then shut down while rescheduling for X minutes later?

http://stackoverflow.com/questions/19652778/running-a-task-every-few-hours

@christocracy

This comment has been minimized.

Show comment
Hide comment
@christocracy

christocracy May 2, 2017

Member

If I were doing this, I'd like use AlarmManager#setRepeating from a service.

Member

christocracy commented May 2, 2017

If I were doing this, I'd like use AlarmManager#setRepeating from a service.

@tdulcet

This comment has been minimized.

Show comment
Hide comment
@tdulcet

tdulcet May 5, 2017

What about using an Android Sync Adapter? It is the most similar to iOS background fetch, as Android also regulates when the sync takes place. It has already been implemented for React Native: https://github.com/ferrannp/react-native-sync-adapter, so it should not be too hard to do for Cordova.

tdulcet commented May 5, 2017

What about using an Android Sync Adapter? It is the most similar to iOS background fetch, as Android also regulates when the sync takes place. It has already been implemented for React Native: https://github.com/ferrannp/react-native-sync-adapter, so it should not be too hard to do for Cordova.

@christocracy

This comment has been minimized.

Show comment
Hide comment
@christocracy

christocracy May 5, 2017

Member

@tdulcet That looks interesting, I'll research that.

Member

christocracy commented May 5, 2017

@tdulcet That looks interesting, I'll research that.

@debevv

This comment has been minimized.

Show comment
Hide comment
@debevv

debevv May 5, 2017

Hi, I'm currently working on a version for Android, but I've hit a wall and I can't go on: it's impossible to execute Javascript code outside a CordovaWebView. So I'm unable to execute the user callback either from a simple Service or a SyncAdapter class.
I was about to make a pull request, but looks like I'm forced to write native code for fetching data in my app.

debevv commented May 5, 2017

Hi, I'm currently working on a version for Android, but I've hit a wall and I can't go on: it's impossible to execute Javascript code outside a CordovaWebView. So I'm unable to execute the user callback either from a simple Service or a SyncAdapter class.
I was about to make a pull request, but looks like I'm forced to write native code for fetching data in my app.

@tdulcet

This comment has been minimized.

Show comment
Hide comment
@tdulcet

tdulcet May 5, 2017

@debevv Did you try any of these Javascript engines for Android:

The React Native Sync Adapter uses the Headless JS Javascript engine, so it seems that a JS engine is necessary for Cordova too.

tdulcet commented May 5, 2017

@debevv Did you try any of these Javascript engines for Android:

The React Native Sync Adapter uses the Headless JS Javascript engine, so it seems that a JS engine is necessary for Cordova too.

@christocracy

This comment has been minimized.

Show comment
Hide comment
@christocracy

christocracy May 5, 2017

Member

If Cordova has some kind of Headless JS mechanism, I'll be all over that.

I've implemented headless js for my React-native-background-Geolocation plugin

Member

christocracy commented May 5, 2017

If Cordova has some kind of Headless JS mechanism, I'll be all over that.

I've implemented headless js for my React-native-background-Geolocation plugin

@tdulcet

This comment has been minimized.

Show comment
Hide comment
@tdulcet

tdulcet May 12, 2017

Any of those Javascript engines should work for executing the user callback from a Sync Adapter, just as Headless JS does for React Native. This comparison: https://medium.com/tech-quizlet/comparison-shopping-searching-for-javascript-engines-for-android-bdc656538f2e says the J2V8 is the best in terms of speed and reliability.

tdulcet commented May 12, 2017

Any of those Javascript engines should work for executing the user callback from a Sync Adapter, just as Headless JS does for React Native. This comparison: https://medium.com/tech-quizlet/comparison-shopping-searching-for-javascript-engines-for-android-bdc656538f2e says the J2V8 is the best in terms of speed and reliability.

@christocracy

This comment has been minimized.

Show comment
Hide comment
@christocracy

christocracy Jan 15, 2018

Member

Android implemented in 5.2.0.

Uses JobScheduler where Build SDK > 21. AlarmManager otherwise.

Member

christocracy commented Jan 15, 2018

Android implemented in 5.2.0.

Uses JobScheduler where Build SDK > 21. AlarmManager otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment