2021-12-16
1470
#react native
Debjyoti Banerjee
83010
Dec 16, 2021 â‹… 5 min read

Run React Native background tasks with Headless JS

Debjyoti Banerjee I'm Debjyoti, software engineer and game developer. Currently exploring JavaScript and Flutter, and trying to come up with solutions to problems in the healthcare sector. Love open source.

Recent posts:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 â‹… 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 â‹… 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 â‹… 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 2024 â‹… 5 min read
View all posts

10 Replies to "Run React Native background tasks with Headless JS"

  1. Where is the BackgroundWorker function created? Are you able to provide a sample of the project structure?

  2. please add import statements of classes. or provide the sample example repo link. android studio not importing automatically.

    1. I’m not aware of your requirements but according to the Android docs, it recommends high priority FCM messages as they are exempt from background restrictions.
      Also, you could try updating your app logic to do something in the work manager but not start a foreground service.
      You could also look into AlarmManager if that suits your use case.

  3. The lack of import statements makes this an hours-long task to reproduce. On top of that, there’s several functions here that just… don’t exist. `bundleExtras` and createChannel` are completely undefined and I can’t find anything online to replace them with or import them from. Kind of useless

    1. Intent service = new Intent(getApplicationContext(), MyTaskService.class);
      Bundle bundle = new Bundle();

      bundle.putString(“foo”, “bar”);
      service.putExtras(bundle);

      getApplicationContext().startService(service);

  4. Headless keeps the task running even when the app gets killed. How can we handle to stop the services when the app gets killed or removed from background?

Leave a Reply