Giter VIP home page Giter VIP logo

Comments (8)

abouquet avatar abouquet commented on June 24, 2024 1

Looking at the code it seems this library only allow us to create a notification channel, service itself is inside the library.
I've also struggled myself into searching where to put my service code ;-)

from react-native-foreground-service.

thehellmaker avatar thehellmaker commented on June 24, 2024 1

Same here. Can this do somethign in the foreground?

from react-native-foreground-service.

prayaslashkari avatar prayaslashkari commented on June 24, 2024

@thehellmaker @abouquet Did you guys find any better libraries or source to create foreground services?

from react-native-foreground-service.

abouquet avatar abouquet commented on June 24, 2024

@thehellmaker @abouquet Did you guys find any better libraries or source to create foreground services?

Nah, I used only vanilla react-native bridge capabilities... And created service from native side manually

from react-native-foreground-service.

prayaslashkari avatar prayaslashkari commented on June 24, 2024

Would really love to see a sample code or maybe if you have any good references?

from react-native-foreground-service.

abouquet avatar abouquet commented on June 24, 2024

@callmemonky , you need a 2 way communication to achieve that.

javascript -> native to trigger a start service using method channels => https://reactnative.dev/docs/native-modules-android
native -> javascript if you need to update javascript part without having a screen on foreground (e.g. react-native-sqlite as a database ). It's called "headless js" => https://reactnative.dev/docs/headless-js-android

With these both resources you should be able to achieve that.

Regards,

[EDIT] And I forgot, to create foreground service, official Android documentation should be enought : https://developer.android.com/guide/components/foreground-services

from react-native-foreground-service.

AxelHgt avatar AxelHgt commented on June 24, 2024

Hi, to make it work you need to add the proper config in the AndroidManifest file:
ex:
<service android:name="com.voximplant.foregroundservice.VIForegroundService" android:foregroundServiceType="location" android:exported="false"> </service>
Once i added the "foregroundServiceType" key, i was able to run the code in background. (In my case it's location update and http request)

However i haven't tested it over a long period of time

from react-native-foreground-service.

bhandari-aditya avatar bhandari-aditya commented on June 24, 2024

you can see the usage of this library in this file : https://github.com/Agontuk/react-native-geolocation-service/blob/master/example/src/App.js

from react-native-foreground-service.

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.