下面列出了com.facebook.react.bridge.ReactApplicationContext#addLifecycleEventListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Deprecated
public UIManagerModule(
ReactApplicationContext reactContext,
ViewManagerResolver viewManagerResolver,
UIImplementationProvider uiImplementationProvider,
int minTimeLeftInFrameForNonBatchedOperationMs) {
super(reactContext);
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
mEventDispatcher = new EventDispatcher(reactContext);
mModuleConstants = createConstants(viewManagerResolver);
mCustomDirectEvents = UIManagerModuleConstants.getDirectEventTypeConstants();
mUIImplementation =
uiImplementationProvider.createUIImplementation(
reactContext,
viewManagerResolver,
mEventDispatcher,
minTimeLeftInFrameForNonBatchedOperationMs);
reactContext.addLifecycleEventListener(this);
}
public RNCAppearanceModule(@NonNull ReactApplicationContext reactContext) {
super(reactContext);
// Only Android 10+ supports dark mode
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
final ReactApplicationContext ctx = reactContext;
mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Configuration newConfig = intent.getParcelableExtra("newConfig");
sendEvent(ctx, "appearanceChanged", getPreferences());
}
};
ctx.addLifecycleEventListener(this);
}
}
public RNDataWedgeIntentsModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
reactContext.addLifecycleEventListener(this);
Log.v(TAG, "Constructing React native DataWedge intents module");
// Register a broadcast receiver to return data back to the application
ObservableObject.getInstance().addObserver(this);
}
public BackgroundGeolocationModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addLifecycleEventListener(this);
facade = new BackgroundGeolocationFacade(getContext(), this);
logger = LoggerManager.getLogger(BackgroundGeolocationModule.class);
}
@Override
public void initialize() {
ReactApplicationContext reactCtx = getReactApplicationContext();
UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
reactCtx.addLifecycleEventListener(this);
uiManager.addUIManagerListener(this);
}
public RNSensorsDataModule(ReactApplicationContext reactContext) {
super(reactContext);
try{
reactContext.addLifecycleEventListener(new SensorsDataLifecycleListener());
}catch(Exception e){
}
RNAgent.ignoreView();
}
public UploaderModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
reactContext.addLifecycleEventListener(this);
if (uploadReceiver == null) {
uploadReceiver = new UploadReceiver();
uploadReceiver.register(reactContext);
}
UploadService.NAMESPACE = reactContext.getApplicationInfo().packageName;
UploadService.HTTP_STACK = new OkHttpStack();
}
public RNBluetoothManagerModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
reactContext.addLifecycleEventListener(this);
btAdapter = BluetoothAdapter.getDefaultAdapter();
registerBroadcastReceiver();
}
public WearCommunicationModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addLifecycleEventListener(this);
googleApiClient = new GoogleApiClient.Builder(getReactApplicationContext()).addApi(Wearable.API)
.addConnectionCallbacks(this)
.build();
}
public BackgroundTimerModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
this.powerManager = (PowerManager) getReactApplicationContext().getSystemService(reactContext.POWER_SERVICE);
this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "rohit_bg_wakelock");
reactContext.addLifecycleEventListener(listener);
}
public RNKakaoLoginsModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
if (KakaoSDK.getAdapter() == null) {
KakaoSDK.init(new KakaoSDKAdapter(reactContext.getApplicationContext()));
} else {
Session.getCurrentSession().clearCallbacks();
}
reactContext.addActivityEventListener(this);
reactContext.addLifecycleEventListener(this);
callback = new SessionCallback();
Session.getCurrentSession().addCallback(callback);
Session.getCurrentSession().checkAndImplicitOpen();
}
public ReactNativeNotificationHubModule(ReactApplicationContext reactContext) {
super(reactContext);
this.mReactContext = reactContext;
this.mLocalBroadcastReceiver = new LocalBroadcastReceiver();
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(reactContext);
localBroadcastManager.registerReceiver(mLocalBroadcastReceiver, new IntentFilter(ReactNativeRegistrationIntentService.TAG));
localBroadcastManager.registerReceiver(mLocalBroadcastReceiver, new IntentFilter(ReactNativeNotificationsHandler.TAG));
reactContext.addLifecycleEventListener(this);
reactContext.addActivityEventListener(this);
}
public TwilioVoiceModule(ReactApplicationContext reactContext,
boolean shouldAskForMicPermission) {
super(reactContext);
if (BuildConfig.DEBUG) {
Voice.setLogLevel(LogLevel.DEBUG);
} else {
Voice.setLogLevel(LogLevel.ERROR);
}
reactContext.addActivityEventListener(this);
reactContext.addLifecycleEventListener(this);
eventManager = new EventManager(reactContext);
callNotificationManager = new CallNotificationManager();
proximityManager = new ProximityManager(reactContext, eventManager);
headsetManager = new HeadsetManager(eventManager);
notificationManager = (android.app.NotificationManager) reactContext.getSystemService(Context.NOTIFICATION_SERVICE);
/*
* Setup the broadcast receiver to be notified of GCM Token updates
* or incoming call messages in this Activity.
*/
voiceBroadcastReceiver = new VoiceBroadcastReceiver();
registerReceiver();
TwilioVoiceModule.callNotificationMap = new HashMap<>();
/*
* Needed for setting/abandoning audio focus during a call
*/
audioManager = (AudioManager) reactContext.getSystemService(Context.AUDIO_SERVICE);
/*
* Ensure the microphone permission is enabled
*/
if (shouldAskForMicPermission && !checkPermissionForMicrophone()) {
requestPermissionForMicrophone();
}
}
MagnetScannerReact(ReactApplicationContext context) {
super(context);
mContext = context;
context.addLifecycleEventListener(this);
context.addActivityEventListener(this);
mPermissionChecker = new PermissionChecker();
mMagnetScanner = new MagnetScanner(context)
.useBle()
.useGeolocation();
}
public GoogleCastModule(ReactApplicationContext reactContext) {
super(reactContext);
if (CAST_AVAILABLE) {
reactContext.addLifecycleEventListener(this);
setupCastListener();
}
}
public RCTChirpSDKModule(ReactApplicationContext reactContext) {
super(reactContext);
context = reactContext;
reactContext.addLifecycleEventListener(this);
}
UnityViewManager(ReactApplicationContext context) {
super();
this.context = context;
context.addLifecycleEventListener(this);
}
public HotspotModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addLifecycleEventListener(this);
hotspot = new HotspotManager(reactContext);
}
public WorkerModule(final ReactApplicationContext reactContext, ReactPackage additionalWorkerPackages[]) {
super(reactContext);
workers = new HashMap<>();
this.additionalWorkerPackages = additionalWorkerPackages;
reactContext.addLifecycleEventListener(this);
}
public RNFirebaseCrashReportModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addLifecycleEventListener(this);
}