GithubHelp home page GithubHelp logo

Comments (3)

tconroy avatar tconroy commented on August 23, 2024 2

👍 ... Not sure how tricky this is to implement, but would be a game changer.

from react-native-background-timer.

DreadfulDeveloper avatar DreadfulDeveloper commented on August 23, 2024 2

@iguatemigarin, maybe it could be implemented with react redux as a state store and listen to native events like onTaskRemoved (android) and applicationWillTerminate (ios). when the app is killed these events should be called, and you could serialize the application state to JSON and write it to disk. When the app boots starts back up, it could Rehydrate the Redux state from JSON and dispatch any events you needed

Just some food for thought :)

from react-native-background-timer.

iguatemigarin avatar iguatemigarin commented on August 23, 2024

Hi, this would be awesome. But some decisions should be made:

  1. Should the app "wakeup" the phone or should the callback run in background?
  2. After a phone reboot, should the callback run or be forgotten?
  3. Should the plugin API expose specific methods for this new feature?

I have an idea of how to do it with Android.

@ocetnik, what do you think?

[EDIT]

After a few tries, I'm not sure if this is possible. Once the app is killed the react native context is lost. I've managed to schedule some calls with Alarm, Intent and BroadcastReceiver. But I can't get back to the original react native context. This means I can schedule some code execution for later, but only native (Java) code, not JS :(

Any thoughts? My Android background is really shallow...

from react-native-background-timer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.