Java 类com.facebook.react.modules.core.DeviceEventManagerModule 实例源码

项目:react-native-system-setting    文件:SystemSetting.java   
private void listenVolume(final ReactApplicationContext reactContext) {
    volumeBR = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals("android.media.VOLUME_CHANGED_ACTION")) {
                WritableMap para = Arguments.createMap();
                para.putDouble("value", getNormalizationVolume(VOL_MUSIC));
                para.putDouble(VOL_VOICE_CALL, getNormalizationVolume(VOL_VOICE_CALL));
                para.putDouble(VOL_SYSTEM, getNormalizationVolume(VOL_SYSTEM));
                para.putDouble(VOL_RING, getNormalizationVolume(VOL_RING));
                para.putDouble(VOL_MUSIC, getNormalizationVolume(VOL_MUSIC));
                para.putDouble(VOL_ALARM, getNormalizationVolume(VOL_ALARM));
                para.putDouble(VOL_NOTIFICATION, getNormalizationVolume(VOL_NOTIFICATION));
                reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                        .emit("EventVolume", para);
            }
        }
    };
    filter = new IntentFilter("android.media.VOLUME_CHANGED_ACTION");

    reactContext.registerReceiver(volumeBR, filter);
}
项目:react-native-screenshot-detect    文件:ScreenShotDetectModule.java   
private void handleMediaRowData(String data, long dateTaken, int width, int height) {
    if (checkScreenShot(data, dateTaken, width, height)) {
        Log.d(TAG, "ScreenShot: path = " + data + "; size = " + width + " * " + height
                + "; date = " + dateTaken);
        WritableMap map = Arguments.createMap();

        try {
            map.putString("url", data);
            map.putDouble("timeStamp", dateTaken);
            // TODO 回调方法。
            if (!checkCallback(data)) {

                mReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                        .emit(ScreenShotEvent, map);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        // 如果在观察区间媒体数据库有数据改变,又不符合截屏规则,则输出到 log 待分析
        Log.w(TAG, "Media content changed, but not screenshot: path = " + data
                + "; size = " + width + " * " + height + "; date = " + dateTaken);
    }
}
项目:react-native-connectivity-status    文件:RNConnectivityStatusModule.java   
@Override
public void onReceive(Context context, Intent intent) {
  final String action = intent.getAction();

  if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
    final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
            BluetoothAdapter.ERROR);
    boolean active = false;
    switch (state) {
      case BluetoothAdapter.STATE_OFF:
        active = false;
        break;
      case BluetoothAdapter.STATE_ON:
        active = true;
        break;
    }

    final WritableMap eventMap = new WritableNativeMap();
    eventMap.putString(EVENT_TYPE, "bluetooth");
    eventMap.putBoolean(EVENT_STATUS, active);
    getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(RN_CONNECTIVITY_STATUS_TOPIC, eventMap);
  }
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
/**
 * This method will give JS the opportunity to receive intents via Linking.
 */
public void onNewIntent(Intent intent) {
  if (mCurrentReactContext == null) {
    FLog.w(ReactConstants.TAG, "Instance detached from instance manager");
  } else {
    String action = intent.getAction();
    Uri uri = intent.getData();

    if (Intent.ACTION_VIEW.equals(action) && uri != null) {
      DeviceEventManagerModule deviceEventManagerModule =
              Assertions.assertNotNull(mCurrentReactContext).getNativeModule(DeviceEventManagerModule.class);
      deviceEventManagerModule.emitNewIntentReceived(uri);
    }

    mCurrentReactContext.onNewIntent(mCurrentActivity, intent);
  }
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:RNLearn_Project1    文件:NativeAnimatedModule.java   
@ReactMethod
public void startListeningToAnimatedNodeValue(final int tag) {
  final AnimatedNodeValueListener listener = new AnimatedNodeValueListener() {
    public void onValueUpdate(double value) {
      WritableMap onAnimatedValueData = Arguments.createMap();
      onAnimatedValueData.putInt("tag", tag);
      onAnimatedValueData.putDouble("value", value);
      getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
          .emit("onAnimatedValueUpdate", onAnimatedValueData);
    }
  };

  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatedNodesManager animatedNodesManager) {
      animatedNodesManager.startListeningToAnimatedNodeValue(tag, listener);
    }
  });
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
/**
 * This method will give JS the opportunity to receive intents via Linking.
 */
public void onNewIntent(Intent intent) {
  if (mCurrentReactContext == null) {
    FLog.w(ReactConstants.TAG, "Instance detached from instance manager");
  } else {
    String action = intent.getAction();
    Uri uri = intent.getData();

    if (Intent.ACTION_VIEW.equals(action) && uri != null) {
      DeviceEventManagerModule deviceEventManagerModule =
              Assertions.assertNotNull(mCurrentReactContext).getNativeModule(DeviceEventManagerModule.class);
      deviceEventManagerModule.emitNewIntentReceived(uri);
    }

    mCurrentReactContext.onNewIntent(mCurrentActivity, intent);
  }
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:RNLearn_Project1    文件:NativeAnimatedModule.java   
@ReactMethod
public void startListeningToAnimatedNodeValue(final int tag) {
  final AnimatedNodeValueListener listener = new AnimatedNodeValueListener() {
    public void onValueUpdate(double value) {
      WritableMap onAnimatedValueData = Arguments.createMap();
      onAnimatedValueData.putInt("tag", tag);
      onAnimatedValueData.putDouble("value", value);
      getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
          .emit("onAnimatedValueUpdate", onAnimatedValueData);
    }
  };

  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatedNodesManager animatedNodesManager) {
      animatedNodesManager.startListeningToAnimatedNodeValue(tag, listener);
    }
  });
}
项目:react-native-libmuse    文件:LibMuseModule.java   
public void SendEvent(String eventName, Object... args) {
    WritableArray argsList = Arguments.createArray();
    for (Object arg : args) {
        if (arg == null)
            argsList.pushNull();
        else if (arg instanceof Boolean)
            argsList.pushBoolean((Boolean)arg);
        else if (arg instanceof Integer)
            argsList.pushInt((Integer)arg);
        else if (arg instanceof Double)
            argsList.pushDouble((Double)arg);
        else if (arg instanceof String)
            argsList.pushString((String)arg);
        else if (arg instanceof WritableArray)
            argsList.pushArray((WritableArray)arg);
        else {
            //Assert(arg instanceof WritableMap, "Event args must be one of: WritableArray, Boolean")
            if (!(arg instanceof WritableMap))
                throw new RuntimeException("Event args must be one of: Boolean, Integer, Double, String, WritableArray, WritableMap");
            argsList.pushMap((WritableMap)arg);
        }
    }

    DeviceEventManagerModule.RCTDeviceEventEmitter jsModuleEventEmitter = reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
    jsModuleEventEmitter.emit(eventName, argsList);
}
项目:react-native-heading    文件:ReactNativeHeadingModule.java   
@Override
public void onSensorChanged(SensorEvent event) {
    if( event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR ){
        // calculate th rotation matrix
        SensorManager.getRotationMatrixFromVector(rMat, event.values);
        // get the azimuth value (orientation[0]) in degree

        newAzimuth = (int) ((((( Math.toDegrees( SensorManager.getOrientation( rMat, orientation )[0] ) + 360 ) % 360) -
                      ( Math.toDegrees( SensorManager.getOrientation( rMat, orientation )[2] ))) +360) % 360);

        //dont react to changes smaller than the filter value
        if (Math.abs(mAzimuth - newAzimuth) < mFilter) {
            return;
        }

        getReactApplicationContext()
                .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit("headingUpdated", (int) newAzimuth);

        mAzimuth = newAzimuth;
    }
}
项目:react-native-android-sms-listener    文件:SmsReceiver.java   
private void receiveMessage(SmsMessage message) {
    if (mContext == null) {
        return;
    }

    if (! mContext.hasActiveCatalystInstance()) {
        return;
    }

    Log.d(
        SmsListenerPackage.TAG,
        String.format("%s: %s", message.getOriginatingAddress(), message.getMessageBody())
    );

    WritableNativeMap receivedMessage = new WritableNativeMap();

    receivedMessage.putString("originatingAddress", message.getOriginatingAddress());
    receivedMessage.putString("body", message.getMessageBody());

    mContext
        .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
        .emit(EVENT, receivedMessage);
}
项目:houndify-smart-mirror    文件:MainActivity.java   
@Override
public void onError(final Exception ex, final VoiceSearchInfo voiceSearchInfo) {
    Log.d("MirrorApp", voiceSearchInfo.getErrorType().toString() + "\n\n" + exceptionToString(ex));

    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
    String json = new String();

    WritableMap params = Arguments.createMap();
    params.putString("error", json);

    ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
    reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit("houndifyResponseError", params);

    if ( phraseSpotterReader == null ) {
        startPhraseSpotting();
    }
}
项目:Ironman    文件:XReactInstanceManagerImpl.java   
@Override
public void onNewIntent(Intent intent) {
  if (mCurrentReactContext == null) {
    FLog.w(ReactConstants.TAG, "Instance detached from instance manager");
  } else {
    String action = intent.getAction();
    Uri uri = intent.getData();

    if (Intent.ACTION_VIEW.equals(action) && uri != null) {
      DeviceEventManagerModule deviceEventManagerModule =
              Assertions.assertNotNull(mCurrentReactContext).getNativeModule(DeviceEventManagerModule.class);
      deviceEventManagerModule.emitNewIntentReceived(uri);
    }

    mCurrentReactContext.onNewIntent(mCurrentActivity, intent);
  }
}
项目:Ironman    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:Ironman    文件:NativeAnimatedModule.java   
@ReactMethod
public void startListeningToAnimatedNodeValue(final int tag) {
  final AnimatedNodeValueListener listener = new AnimatedNodeValueListener() {
    public void onValueUpdate(double value) {
      WritableMap onAnimatedValueData = Arguments.createMap();
      onAnimatedValueData.putInt("tag", tag);
      onAnimatedValueData.putDouble("value", value);
      getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
          .emit("onAnimatedValueUpdate", onAnimatedValueData);
    }
  };

  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatedNodesManager animatedNodesManager) {
      animatedNodesManager.startListeningToAnimatedNodeValue(tag, listener);
    }
  });
}
项目:react-native-simple-compass    文件:RNSimpleCompassModule.java   
@Override
public void onSensorChanged(SensorEvent event) {
    if( event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR ){
        // calculate th rotation matrix
        SensorManager.getRotationMatrixFromVector(rMat, event.values);
        // get the azimuth value (orientation[0]) in degree
        int newAzimuth = (int) ( Math.toDegrees( SensorManager.getOrientation( rMat, orientation )[0] ) + 360 ) % 360;

        //dont react to changes smaller than the filter value
        if (Math.abs(mAzimuth - newAzimuth) < mFilter) {
            return;
        }

        mAzimuth = newAzimuth;

        getReactApplicationContext()
                .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit("HeadingUpdated", mAzimuth);
    }
}
项目:rn-notification    文件:NotificationModule.java   
@Override
public void onReceive(Context context, Intent intent) {
    Bundle extras = intent.getExtras();

    // Focus the application
    String packageName = context.getApplicationContext().getPackageName();
    Intent focusIntent = context.getPackageManager().getLaunchIntentForPackage(packageName).cloneFilter();

    focusIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

    final Activity activity = getActivity();
    if (activity != null) {
        activity.startActivity(focusIntent);
    }

    // Send event to JS
    WritableMap params = Arguments.createMap();
    params.putInt("id", extras.getInt(NotificationEventReceiver.NOTIFICATION_ID));
    params.putString("payload", extras.getString(NotificationEventReceiver.PAYLOAD));

    getReactApplicationContext()
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit("RNNotification:press", params);

    this.setResultCode(Activity.RESULT_OK);
}
项目:react-native-music-control    文件:MusicControlListener.java   
private static void sendEvent(ReactApplicationContext context, String type, Object value) {
    WritableMap data = Arguments.createMap();
    data.putString("name", type);

    if(value == null) {
        // NOOP
    } else if(value instanceof Double || value instanceof Float) {
        data.putDouble("value", (double)value);
    } else if(value instanceof Boolean) {
        data.putBoolean("value", (boolean)value);
    } else if(value instanceof Integer) {
        data.putInt("value", (int)value);
    }

    context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("RNMusicControlEvent", data);
}
项目:react-native-system-setting    文件:SystemSetting.java   
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
    SysSettings setting = SysSettings.get(requestCode);
    if (setting != SysSettings.UNKNOW) {
        mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit(setting.event, null);
        mContext.removeActivityEventListener(this);
    }
}
项目:react-native-google-fit    文件:GoogleFitManager.java   
private void sendEvent(ReactContext reactContext,
                       String eventName,
                       @Nullable WritableMap params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
项目:react-native-google-fit    文件:StepHistory.java   
private void sendEvent(ReactContext reactContext,
                       String eventName,
                       @Nullable WritableArray params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
项目:react-native-google-fit    文件:StepSensor.java   
private void sendEvent(ReactContext reactContext,
                       String eventName,
                       @Nullable WritableMap params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
项目:react-native-google-fit    文件:StepCounter.java   
private void sendEvent(ReactContext reactContext,
                       String eventName,
                       @Nullable WritableMap params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
项目:react-native-threads    文件:ThreadSelfModule.java   
@ReactMethod
public void postMessage(String data) {
    if (parentContext == null) { return; }

    parentContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit("Thread" + String.valueOf(threadId), data);
}
项目:react-native-threads    文件:JSThread.java   
public void postMessage(String message) {
    if (reactContext == null) {
        return;
    }

    reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit("ThreadMessage", message);
}
项目:react-native-twilio-chat    文件:RCTTwilioAccessManager.java   
@Override
public void onError(AccessManager twilioAccessManager, String s) {
    WritableMap params = Arguments.createMap();
    params.putString("error",s);
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit("accessManager:tokenInvalid",params);
}
项目:react-native-sunmi-inner-printer    文件:PrinterReceiver.java   
@Override
public void onReceive(Context context, Intent data) {
    String action = data.getAction();
    String type = "PrinterStatus";
    Log.d("PrinterReceiver", action);
        SunmiInnerPrinterModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit(type, action);
}
项目:react-native-call-events    文件:CallStateListener.java   
@Override
public void onCallStateChanged(int state, String incomingNumber) {
    final Context context = reactContext.getApplicationContext();
    final Intent i = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
    i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    WritableMap params = this.createMap();
    params.putString("phonenumber", incomingNumber);
    if (TelephonyManager.CALL_STATE_OFFHOOK == state) {
        params.putString("state", "CALL_STATE_OFFHOOK");
        if( returnOnCall ) {
            context.startActivity(i);
        }
    }
    if (TelephonyManager.CALL_STATE_RINGING == state) {
        params.putString("state", "CALL_STATE_RINGING");
        if( returnOnCall ) {
            context.startActivity(i);
        }
    }
    if (TelephonyManager.CALL_STATE_IDLE == state) {
        params.putString("state", "CALL_STATE_END");
        if ( returnOnEnd ) {
            context.startActivity(i);
        }
    }

    reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("callStatusUpdate", params);
}
项目:react-native-call-events    文件:CallStateListenerTest.java   
@Before
public void setup() {
    when(mockReactContext.getApplicationContext()).thenReturn(mockApplicationContext);
    when(mockApplicationContext.getPackageManager()).thenReturn(mockPackageManager);
    when(mockApplicationContext.getPackageName()).thenReturn(FAKE_PACKAGE_NAME);
    when(mockPackageManager.getLaunchIntentForPackage(FAKE_PACKAGE_NAME)).thenReturn(mockIntent);
    when(mockActivity.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mockTelephonyManager);
    when(mockReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)).thenReturn(mockEmitter);
}
项目:react-native-sound-player    文件:RNSoundPlayerModule.java   
private void sendEvent(ReactApplicationContext reactContext,
                     String eventName,
                     @Nullable WritableMap params) {
  reactContext
      .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
      .emit(eventName, params);
}
项目:react-native-devsettings-android    文件:DevSettingsModule.java   
@ReactMethod
public void toggleElementInspector() {
    if (!useDeveloperSupport) return;
    DevInternalSettings mDevSettings = (DevInternalSettings) devManager.getDevSettings();
    mDevSettings.setElementInspectorEnabled(!mDevSettings.isElementInspectorEnabled());
    reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
        .emit("toggleElementInspector", null);
}
项目:react-native-fused-location    文件:FusedLocationModule.java   
private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
    if (reactContext.hasActiveCatalystInstance()) {
        reactContext
                .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit(eventName, params);
    } else {
        Log.i(TAG, "Waiting for CatalystInstance...");
    }
}
项目:React-Native-Music-Player    文件:MusicPlayerModule.java   
private void sendEvent(ReactContext reactContext,
                       String eventName,
                       @Nullable WritableMap params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
项目:react-native-android-text-to-speech    文件:RNAndroidTextToSpeechModule.java   
private void sendEvent(String eventName, String utteranceId) {
    WritableMap params = Arguments.createMap();
    params.putString("utteranceId", utteranceId);
    getReactApplicationContext()
        .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
        .emit(eventName, params);
}
项目:RNRxBluetooth    文件:RNRxBluetoothModule.java   
private void sendEventToJs(String eventName, @Nullable WritableMap params) {
    try {
        if (reactContext.hasActiveCatalystInstance()) {
            if (debug) {
                Log.d(TAG, "Sending event: " + eventName);
            }
            reactContext
                    .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                    .emit(eventName, params);
        }
    } catch (Exception error) {
        error.printStackTrace();
        Log.e(TAG, error.toString());
    }
}
项目:react-native-network-connection-class    文件:Module.java   
private void sendEvent(ReactContext reactContext,
                       String eventName,
                       WritableMap params) {
  reactContext
    .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
    .emit(eventName, params);
}
项目:react-native-fingerprint-identify    文件:RNFingerprintIdentifyModule.java   
private void sendEvent(String status, String message) {
  WritableMap params = Arguments.createMap();
  params.putString("status", status);
  params.putString("message", message);
  reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
    .emit("FINGERPRINT_IDENTIFY_STATUS", params);
}
项目:react-native-connectivity-status    文件:RNConnectivityStatusModule.java   
@Override
public void onReceive(Context context, Intent intent) {
  final boolean locationEnabled = intent.getAction() != null
          && intent.getAction().matches(LocationManager.PROVIDERS_CHANGED_ACTION)
          && checkLocation();

  final WritableMap eventMap = new WritableNativeMap();
  eventMap.putString(EVENT_TYPE, "location");
  eventMap.putBoolean(EVENT_STATUS, locationEnabled);
  getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(RN_CONNECTIVITY_STATUS_TOPIC, eventMap);
}
项目:RNLearn_Project1    文件:AccessibilityInfoModule.java   
private void updateAndSendChangeEvent(boolean enabled) {
    if (mEnabled != enabled) {
        mEnabled = enabled;
        getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit(EVENT_NAME, mEnabled);
    }
}