Comments (8)
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.
Same here. Can this do somethign in the foreground?
from react-native-foreground-service.
@thehellmaker @abouquet Did you guys find any better libraries or source to create foreground services?
from react-native-foreground-service.
@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.
Would really love to see a sample code or maybe if you have any good references?
from react-native-foreground-service.
@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.
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.
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)
- how to STOP it? HOT 7
- Android 12 support HOT 2
- Kill on crash or on startup after crash
- Crash on IOS HOT 1
- Android 12 crash: Exception: startForegroundService() not allowed due to mAllowStartForeground false HOT 4
- Error occur while building production release: resource android:attr/lStar not found. HOT 10
- Service doesn't stop after closing the app HOT 2
- Getting `> Task :voximplant_react-native-foreground-service:verifyReleaseResources FAILED` Error while Generating Release APK HOT 6
- Getting type error when upgrading to 2.0.0 to 3.0.1 HOT 2
- Foreground Notification is not working in some android mobiles
- Native error on Android 13: VIForegroundService: Foreground service is not started HOT 2
- Pixel 6 & Android 13 => notification not created HOT 1
- Cannot start service HOT 2
- How to change the notification's icon color
- 服务被杀死,内部mqtt还能运行吗?
- 我进程已经杀死了,但是服务已经没有了?
- This library seems pretty dead, are there any alternatives? HOT 3
- No compiling with fresh project on React native 0.72.0 HOT 8
- update SDK HOT 1
- Could not determine the dependencies of task ':voximplant_react-native-foreground-service:bundleLibCompileToJarDebug'. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-foreground-service.