Java Code Examples for com.facebook.react.bridge.ReactApplicationContext#addActivityEventListener()

The following examples show how to use com.facebook.react.bridge.ReactApplicationContext#addActivityEventListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TwilioVoiceModule.java    From react-native-twilio-programmable-voice with MIT License 5 votes vote down vote up
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();
    }
}
 
Example 2
Source File: MagnetScannerReact.java    From magnet-client with Mozilla Public License 2.0 5 votes vote down vote up
MagnetScannerReact(ReactApplicationContext context) {
    super(context);
    mContext = context;

    context.addLifecycleEventListener(this);
    context.addActivityEventListener(this);

    mPermissionChecker = new PermissionChecker();
    mMagnetScanner = new MagnetScanner(context)
            .useBle()
            .useGeolocation();
}
 
Example 3
Source File: RNPushNotification.java    From react-native-push-notification-CE with MIT License 5 votes vote down vote up
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();
}
 
Example 4
Source File: RNKakaoLoginsModule.java    From react-native-kakao-login with MIT License 5 votes vote down vote up
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();
}
 
Example 5
Source File: RNPushNotification.java    From react-native-push-notification with MIT License 5 votes vote down vote up
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();
}
 
Example 6
Source File: InAppBillingBridge.java    From react-native-billing with MIT License 5 votes vote down vote up
public InAppBillingBridge(ReactApplicationContext reactContext, String licenseKey) {
    super(reactContext);
    _reactContext = reactContext;
    LICENSE_KEY = licenseKey;

    reactContext.addActivityEventListener(this);
}
 
Example 7
Source File: ReactNativeNotificationHubModule.java    From react-native-azurenotificationhub with MIT License 5 votes vote down vote up
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);
}
 
Example 8
Source File: BleManager.java    From react-native-ble-manager with Apache License 2.0 5 votes vote down vote up
public BleManager(ReactApplicationContext reactContext) {
	super(reactContext);
	context = reactContext;
	this.reactContext = reactContext;
	reactContext.addActivityEventListener(this);
	Log.d(LOG_TAG, "BleManager created");
}
 
Example 9
Source File: AppShortcutsModule.java    From react-native-quick-actions with MIT License 5 votes vote down vote up
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);
        }
    });
}
 
Example 10
Source File: CafeBazaar.java    From react-native-cafe-bazaar with MIT License 5 votes vote down vote up
public CafeBazaar(ReactApplicationContext reactContext, String licenseKey) {
    super(reactContext);
    _reactContext = reactContext;
    this.LICENSE_KEY = licenseKey;

    reactContext.addActivityEventListener(this);
}
 
Example 11
Source File: MercadoPagoCheckoutModule.java    From react-native-mercadopago-checkout with MIT License 4 votes vote down vote up
private void init(@NonNull ReactApplicationContext context) {
    eventResultListener = new MercadoPagoCheckoutEventListener();
    context.addActivityEventListener(eventResultListener);
}
 
Example 12
Source File: RNShareModule.java    From react-native-share with MIT License 4 votes vote down vote up
public RNShareModule(ReactApplicationContext reactContext) {
    super(reactContext);
    reactContext.addActivityEventListener(this);
    this.reactContext = reactContext;
}
 
Example 13
Source File: RNMailComposeModule.java    From react-native-mail-compose with MIT License 4 votes vote down vote up
public RNMailComposeModule(final ReactApplicationContext reactContext) {
    super(reactContext);
    reactContext.addActivityEventListener(mActivityEventListener);
}
 
Example 14
Source File: OnfidoSDK.java    From onfido-sdk-react-native-sample-app with MIT License 4 votes vote down vote up
public OnfidoSDK(ReactApplicationContext reactContext) {
    super(reactContext);
    client = OnfidoFactory.create(reactContext).getClient();
    reactContext.addActivityEventListener(mActivityEventListener);
}
 
Example 15
Source File: RNSyanImagePickerModule.java    From react-native-syan-image-picker with MIT License 4 votes vote down vote up
public RNSyanImagePickerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    this.reactContext = reactContext;
    reactContext.addActivityEventListener(mActivityEventListener);
}
 
Example 16
Source File: RNMessageComposeModule.java    From react-native-message-compose with MIT License 4 votes vote down vote up
public RNMessageComposeModule(final ReactApplicationContext reactContext) {
    super(reactContext);
    reactContext.addActivityEventListener(mActivityEventListener);
}
 
Example 17
Source File: RNGoogleSigninModule.java    From google-signin with MIT License 4 votes vote down vote up
public RNGoogleSigninModule(final ReactApplicationContext reactContext) {
    super(reactContext);
    promiseWrapper = new PromiseWrapper();
    reactContext.addActivityEventListener(new RNGoogleSigninActivityEventListener());
}
 
Example 18
Source File: ContactsWrapper.java    From react-native-contacts-wrapper with MIT License 4 votes vote down vote up
public ContactsWrapper(ReactApplicationContext reactContext) {
    super(reactContext);
    this.contentResolver = getReactApplicationContext().getContentResolver();
    reactContext.addActivityEventListener(this);
}
 
Example 19
Source File: Braintree.java    From react-native-braintree-android with MIT License 4 votes vote down vote up
public Braintree(ReactApplicationContext reactContext) {
  super(reactContext);
  reactContext.addActivityEventListener(new BraintreeActivityListener());
}
 
Example 20
Source File: RNPhotoEditorModule.java    From react-native-photo-editor with Apache License 2.0 2 votes vote down vote up
public RNPhotoEditorModule(ReactApplicationContext reactContext) {
  super(reactContext);

  reactContext.addActivityEventListener(mActivityEventListener);

}