下面列出了com.facebook.react.bridge.ReactApplicationContext#addActivityEventListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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 RNPushNotification(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(this);
Application applicationContext = (Application) reactContext.getApplicationContext();
// The @ReactNative methods use this
mRNPushNotificationHelper = new RNPushNotificationHelper(applicationContext);
// This is used to delivery callbacks to JS
mJsDelivery = new RNPushNotificationJsDelivery(reactContext);
registerNotificationsRegistration();
}
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 RNPushNotification(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(this);
Application applicationContext = (Application) reactContext.getApplicationContext();
// The @ReactNative methods use this
mRNPushNotificationHelper = new RNPushNotificationHelper(applicationContext);
// This is used to delivery callbacks to JS
mJsDelivery = new RNPushNotificationJsDelivery(reactContext);
mRNPushNotificationHelper.checkOrCreateDefaultChannel();
}
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 BleManager(ReactApplicationContext reactContext) {
super(reactContext);
context = reactContext;
this.reactContext = reactContext;
reactContext.addActivityEventListener(this);
Log.d(LOG_TAG, "BleManager created");
}
public CafeBazaar(ReactApplicationContext reactContext, String licenseKey) {
super(reactContext);
_reactContext = reactContext;
this.LICENSE_KEY = licenseKey;
reactContext.addActivityEventListener(this);
}
AppShortcutsModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(new ActivityEventListener() {
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
// Do nothing
}
@Override
public void onNewIntent(Intent intent) {
sendJSEvent(intent);
}
});
}
public InAppBillingBridge(ReactApplicationContext reactContext, String licenseKey) {
super(reactContext);
_reactContext = reactContext;
LICENSE_KEY = licenseKey;
reactContext.addActivityEventListener(this);
}
public RNShareModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(this);
this.reactContext = reactContext;
}
public Braintree(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(new BraintreeActivityListener());
}
public ContactsWrapper(ReactApplicationContext reactContext) {
super(reactContext);
this.contentResolver = getReactApplicationContext().getContentResolver();
reactContext.addActivityEventListener(this);
}
public RNGoogleSigninModule(final ReactApplicationContext reactContext) {
super(reactContext);
promiseWrapper = new PromiseWrapper();
reactContext.addActivityEventListener(new RNGoogleSigninActivityEventListener());
}
public RNMessageComposeModule(final ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(mActivityEventListener);
}
public RNSyanImagePickerModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
reactContext.addActivityEventListener(mActivityEventListener);
}
public OnfidoSDK(ReactApplicationContext reactContext) {
super(reactContext);
client = OnfidoFactory.create(reactContext).getClient();
reactContext.addActivityEventListener(mActivityEventListener);
}
public RNMailComposeModule(final ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(mActivityEventListener);
}
private void init(@NonNull ReactApplicationContext context) {
eventResultListener = new MercadoPagoCheckoutEventListener();
context.addActivityEventListener(eventResultListener);
}
public RNPhotoEditorModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(mActivityEventListener);
}