本文整理汇总了Java中com.facebook.react.jstasks.HeadlessJsTaskContext类的典型用法代码示例。如果您正苦于以下问题:Java HeadlessJsTaskContext类的具体用法?Java HeadlessJsTaskContext怎么用?Java HeadlessJsTaskContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HeadlessJsTaskContext类属于com.facebook.react.jstasks包,在下文中一共展示了HeadlessJsTaskContext类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDestroy
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
if (getReactNativeHost().hasInstance()) {
ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext != null) {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(reactContext);
headlessJsTaskContext.removeTaskEventListener(this);
}
}
if (sWakeLock != null) {
sWakeLock.release();
}
}
示例2: notifyTaskFinished
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@ReactMethod
public void notifyTaskFinished(int taskId) {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
if (headlessJsTaskContext.isTaskRunning(taskId)) {
headlessJsTaskContext.finishTask(taskId);
} else {
FLog.w(
HeadlessJsTaskSupportModule.class,
"Tried to finish non-active task with id %d. Did it time out?",
taskId);
}
}
示例3: initialize
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void initialize() {
getReactApplicationContext().addLifecycleEventListener(this);
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
headlessJsTaskContext.addTaskEventListener(this);
}
示例4: onHeadlessJsTaskFinish
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void onHeadlessJsTaskFinish(int taskId) {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
if (!headlessJsTaskContext.hasActiveTasks()) {
isRunningTasks.set(false);
clearFrameCallback();
maybeIdleCallback();
}
}
示例5: onCatalystInstanceDestroy
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void onCatalystInstanceDestroy() {
clearFrameCallback();
clearChoreographerIdleCallback();
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
headlessJsTaskContext.removeTaskEventListener(this);
}
示例6: clearFrameCallback
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
private void clearFrameCallback() {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
if (mFrameCallbackPosted && isPaused.get() &&
!headlessJsTaskContext.hasActiveTasks()) {
Assertions.assertNotNull(mReactChoreographer).removeFrameCallback(
ReactChoreographer.CallbackType.TIMERS_EVENTS,
mTimerFrameCallback);
mFrameCallbackPosted = false;
}
}
示例7: initialize
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void initialize() {
// Safe to acquire choreographer here, as initialize() is invoked from UI thread.
mReactChoreographer = ReactChoreographer.getInstance();
getReactApplicationContext().addLifecycleEventListener(this);
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
headlessJsTaskContext.addTaskEventListener(this);
}
示例8: onHeadlessJsTaskFinish
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void onHeadlessJsTaskFinish(int taskId) {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
if (!headlessJsTaskContext.hasActiveTasks()) {
isRunningTasks.set(false);
clearChoreographerCallback();
maybeClearChoreographerIdleCallback();
}
}
示例9: onCatalystInstanceDestroy
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@Override
public void onCatalystInstanceDestroy() {
clearChoreographerCallback();
clearChoreographerIdleCallback();
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
headlessJsTaskContext.removeTaskEventListener(this);
}
示例10: clearChoreographerCallback
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
private void clearChoreographerCallback() {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
if (mFrameCallbackPosted && isPaused.get() &&
!headlessJsTaskContext.hasActiveTasks()) {
Assertions.assertNotNull(mReactChoreographer).removeFrameCallback(
ReactChoreographer.CallbackType.TIMERS_EVENTS,
mTimerFrameCallback);
mFrameCallbackPosted = false;
}
}
示例11: invokeStartTask
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
private void invokeStartTask(ReactContext reactContext, HeadlessJsTaskConfig taskConfig) {
HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
headlessJsTaskContext.addTaskEventListener(this);
int taskId = headlessJsTaskContext.startTask(taskConfig);
mActiveTasks.add(taskId);
}
示例12: notifyTaskFinished
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
@ReactMethod
public void notifyTaskFinished(int taskId) {
HeadlessJsTaskContext headlessJsTaskContext =
HeadlessJsTaskContext.getInstance(getReactApplicationContext());
headlessJsTaskContext.finishTask(taskId);
}
示例13: invokeStartTask
import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入依赖的package包/类
private void invokeStartTask(ReactContext reactContext, final HeadlessJsTaskConfig taskConfig) {
final HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
headlessJsTaskContext.addTaskEventListener(this);
mActiveTaskContext = headlessJsTaskContext;
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
int taskId = headlessJsTaskContext.startTask(taskConfig);
}
});
}
开发者ID:transistorsoft,项目名称:react-native-background-geolocation,代码行数:17,代码来源:RNBackgroundGeolocationEventReceiver.java