Skip to content

Commit

Permalink
Add note to add the service to AndroidManifest
Browse files Browse the repository at this point in the history
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 #14813

Differential Revision: D5384460

Pulled By: hramos

fbshipit-source-id: 6131d7901d3324da97672141c4774b7810051526
  • Loading branch information
LironEr authored and facebook-github-bot committed Jul 7, 2017
1 parent 9afb71f commit 6db97d6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/HeadlessJSAndroid.md
Expand Up @@ -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. 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 ## 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. * 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.
Expand Down

0 comments on commit 6db97d6

Please sign in to comment.