Android: add support for headless js tasks

Summary: Provide a base `HeadlessJsTaskService` class that can be extended to run JS in headless mode in response to some event. Added `HeadlessJsTaskEventListener` for modules that are interested in background lifecycle events, and `HeadlessJsTaskContext` that basically extends `ReactContext` without touching it. The react instance is shared with the rest of the app (e.g. activities) through the `ReactNativeHost`.

Reviewed By: astreet

Differential Revision: D3225753

fbshipit-source-id: 2c5e7679636f31e0e7842d8a67aeb95baf47c563
This commit is contained in:
Felix Oghina
2016-09-29 03:43:59 -07:00
committed by Facebook Github Bot
parent 542ab8643e
commit 3080b8d26c
14 changed files with 650 additions and 31 deletions

View File

@@ -0,0 +1,23 @@
include_defs('//ReactAndroid/DEFS')
DEPS = [
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_dep('libraries/fbcore/src/main/java/com/facebook/common/logging:logging'),
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
]
android_library(
name = 'jstasks',
srcs = glob(['*.java']),
deps = DEPS,
visibility = [
'PUBLIC',
],
)
project_config(
src_target = ':jstasks',
)