use of com.benmu.framework.manager.impl.LifecycleManager in project WeexErosFramework by bmfe.
the class BMWXApplication method registerLifecycle.
private void registerLifecycle() {
LifecycleManager lifecycleManager = ManagerFactory.getManagerService(LifecycleManager.class);
lifecycleManager.register(this).setOnTaskSwitchListenner(new LifecycleManager.OnTaskSwitchListener() {
@Override
public void onTaskSwitchToForeground() {
Activity activity = RouterTracker.peekActivity();
if (activity != null) {
GlobalEventManager.appActive(((AbstractWeexActivity) activity).getWXSDkInstance());
}
// app resume try check verison
if (mVersionChecker != null) {
mVersionChecker.checkVersion();
}
}
@Override
public void onTaskSwitchToBackground() {
Activity activity = RouterTracker.peekActivity();
if (activity != null) {
GlobalEventManager.appDeactive(((AbstractWeexActivity) activity).getWXSDkInstance());
}
}
});
}
Aggregations