mirror of
https://github.com/status-im/react-native.git
synced 2025-01-11 18:14:14 +00:00
Add note to add the service to AndroidManifest
Summary: If not you will try to start the service but nothing would happen <!-- Thank you for sending the PR! If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos! Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native. Happy contributing! --> Closes https://github.com/facebook/react-native/pull/14813 Differential Revision: D5384460 Pulled By: hramos fbshipit-source-id: 6131d7901d3324da97672141c4774b7810051526
This commit is contained in:
parent
9afb71fde8
commit
6db97d638d
@ -52,6 +52,12 @@ public class MyTaskService extends HeadlessJsTaskService {
|
||||
|
||||
Now, whenever you [start your service][0], e.g. as a periodic task or in response to some system event / broadcast, JS will spin up, run your task, then spin down.
|
||||
|
||||
Remember to add the service to your `AndroidManifest` file:
|
||||
|
||||
```
|
||||
<service android:name="com.example.MyTaskService" />
|
||||
```
|
||||
|
||||
## Caveats
|
||||
|
||||
* By default, your app will crash if you try to run a task while the app is in the foreground. This is to prevent developers from shooting themselves in the foot by doing a lot of work in a task and slowing the UI. There is a way around this.
|
||||
|
Loading…
x
Reference in New Issue
Block a user