com.facebook.react.bridge.ActivityEventListener Java Examples

The following examples show how to use com.facebook.react.bridge.ActivityEventListener. 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: RNSmsRetrieverModule.java    From react-native-sms-retriever with MIT License 6 votes vote down vote up
@SuppressWarnings("unused")
@ReactMethod
public void requestPhoneNumber(final Promise promise) {
  final ReactApplicationContext context = getReactApplicationContext();
  final Activity activity = getCurrentActivity();
  final ActivityEventListener eventListener = mPhoneNumberHelper.getActivityEventListener();

  context.addActivityEventListener(eventListener);

  mPhoneNumberHelper.setListener(new PhoneNumberHelper.Listener() {
    @Override
    public void phoneNumberResultReceived() {
      context.removeActivityEventListener(eventListener);
    }
  });

  mPhoneNumberHelper.requestPhoneNumber(context, activity, promise);
}
 
Example #2
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 #3
Source File: PhoneNumberHelper.java    From react-native-sms-retriever with MIT License 4 votes vote down vote up
ActivityEventListener getActivityEventListener() {
    return mActivityEventListener;
}
 
Example #4
Source File: RNFileSelectorModule.java    From react-native-file-selector with Apache License 2.0 4 votes vote down vote up
public RNFileSelectorModule(ReactApplicationContext reactContext) {
  super(reactContext);

  getReactApplicationContext().addActivityEventListener(new ActivityEventListener());
}
 
Example #5
Source File: ArViewModule.java    From react-native-arcore with MIT License 4 votes vote down vote up
public ArViewModule(ReactApplicationContext reactContext) {
    super(reactContext);
    reactContext.addActivityEventListener((ActivityEventListener) this);
}