com.facebook.react.bridge.Arguments Java Examples
The following examples show how to use
com.facebook.react.bridge.Arguments.
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: FirestackStorage.java From react-native-firestack with MIT License | 6 votes |
private WritableMap getDownloadData(final UploadTask.TaskSnapshot taskSnapshot) { Uri downloadUrl = taskSnapshot.getDownloadUrl(); StorageMetadata d = taskSnapshot.getMetadata(); WritableMap resp = Arguments.createMap(); resp.putString("downloadUrl", downloadUrl.toString()); resp.putString("fullPath", d.getPath()); resp.putString("bucket", d.getBucket()); resp.putString("name", d.getName()); WritableMap metadataObj = Arguments.createMap(); metadataObj.putString("cacheControl", d.getCacheControl()); metadataObj.putString("contentDisposition", d.getContentDisposition()); metadataObj.putString("contentType", d.getContentType()); resp.putMap("metadata", metadataObj); return resp; }
Example #2
Source File: ReactNativeUtilTest.java From react-native-azurenotificationhub with MIT License | 6 votes |
@Test public void testEmitIntent() { when(mReactApplicationContext.hasActiveCatalystInstance()).thenReturn(true); DeviceEventManagerModule.RCTDeviceEventEmitter emitter = PowerMockito.mock( DeviceEventManagerModule.RCTDeviceEventEmitter.class); when(mReactApplicationContext.getJSModule(any())).thenReturn(emitter); when(Arguments.createMap()).thenReturn(PowerMockito.mock(WritableMap.class)); Intent intent = PowerMockito.mock(Intent.class); when(intent.getStringExtra(KEY_INTENT_EVENT_NAME)).thenReturn("event"); when(intent.getStringExtra(KEY_INTENT_EVENT_TYPE)).thenReturn(INTENT_EVENT_TYPE_BUNDLE); when(intent.getExtras()).thenReturn(mBundle); emitIntent(mReactApplicationContext, intent); verify(mReactApplicationContext, times(1)).hasActiveCatalystInstance(); verify(mReactApplicationContext, times(1)).getJSModule(any()); verify(emitter, times(1)).emit(eq("event"), any(WritableMap.class)); reset(intent); when(intent.getStringExtra(KEY_INTENT_EVENT_NAME)).thenReturn("event"); when(intent.getStringExtra(KEY_INTENT_EVENT_TYPE)).thenReturn(INTENT_EVENT_TYPE_STRING); when(intent.getStringExtra(KEY_INTENT_EVENT_STRING_DATA)).thenReturn("data"); emitIntent(mReactApplicationContext, intent); verify(mReactApplicationContext, times(2)).hasActiveCatalystInstance(); verify(mReactApplicationContext, times(2)).getJSModule(any()); verify(emitter, times(1)).emit("event", "data"); }
Example #3
Source File: OTSessionManager.java From opentok-react-native with MIT License | 6 votes |
@Override public void onVideoEnabled(SubscriberKit subscriber, String reason) { String streamId = Utils.getStreamIdBySubscriber(subscriber); if (streamId.length() > 0) { ConcurrentHashMap<String, Stream> streams = sharedState.getSubscriberStreams(); Stream mStream = streams.get(streamId); WritableMap subscriberInfo = Arguments.createMap(); if (mStream != null) { subscriberInfo.putMap("stream", EventUtils.prepareJSStreamMap(mStream, subscriber.getSession())); } subscriberInfo.putString("reason", reason); sendEventMap(this.getReactApplicationContext(), subscriberPreface + "onVideoEnabled", subscriberInfo); } printLogs("onVideoEnabled " + reason); }
Example #4
Source File: GoogleFitManager.java From react-native-google-fit with MIT License | 6 votes |
@Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_OAUTH) { mAuthInProgress = false; if (resultCode == Activity.RESULT_OK) { // Make sure the app is not already connected or attempting to connect if (!mApiClient.isConnecting() && !mApiClient.isConnected()) { mApiClient.connect(); } } else if (resultCode == Activity.RESULT_CANCELED) { Log.e(TAG, "Authorization - Cancel"); WritableMap map = Arguments.createMap(); map.putString("message", "" + "Authorization cancelled"); sendEvent(mReactContext, "GoogleFitAuthorizeFailure", map); } } }
Example #5
Source File: OTSessionManager.java From opentok-react-native with MIT License | 6 votes |
@Override public void onError(SubscriberKit subscriberKit, OpentokError opentokError) { String streamId = Utils.getStreamIdBySubscriber(subscriberKit); if (streamId.length() > 0) { ConcurrentHashMap<String, Stream> streams = sharedState.getSubscriberStreams(); Stream mStream = streams.get(streamId); WritableMap subscriberInfo = Arguments.createMap(); if (mStream != null) { subscriberInfo.putMap("stream", EventUtils.prepareJSStreamMap(mStream, subscriberKit.getSession())); } subscriberInfo.putMap("error", EventUtils.prepareJSErrorMap(opentokError)); sendEventMap(this.getReactApplicationContext(), subscriberPreface + "onError", subscriberInfo); } printLogs("onError: "+opentokError.getErrorDomain() + " : " + opentokError.getErrorCode() + " - "+opentokError.getMessage()); }
Example #6
Source File: OAuthManagerModule.java From react-native-oauth with MIT License | 6 votes |
@ReactMethod public void deauthorize(final String providerName, final Callback onComplete) { try { Log.i(TAG, "deauthorizing " + providerName); HashMap<String,Object> cfg = this.getConfiguration(providerName); final String authVersion = (String) cfg.get("auth_version"); _credentialsStore.delete(providerName); WritableMap resp = Arguments.createMap(); resp.putString("status", "ok"); onComplete.invoke(null, resp); } catch (Exception ex) { exceptionCallback(ex, onComplete); } }
Example #7
Source File: RNYandexMapKitView.java From react-native-yandexmapkit with MIT License | 6 votes |
@Override public boolean onFinishGeoCode(GeoCode geoCode) { if (geoCode != null) { WritableMap payload = Arguments.createMap(); payload.putString("displayName", geoCode.getDisplayName()); payload.putString("kind", geoCode.getKind()); payload.putString("title", geoCode.getTitle()); payload.putString("subtitle", geoCode.getSubtitle()); WritableMap point = Arguments.createMap(); GeoPoint geoPoint = geoCode.getGeoPoint(); point.putDouble("latitude", geoPoint.getLat()); point.putDouble("longitude", geoPoint.getLon()); payload.putMap("point", point); ReactContext reactContext = (ReactContext) getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(this.getId(), GEOCODING_EVENT, payload); } return true; }
Example #8
Source File: OrientationModule.java From react-native-orientation-locker with MIT License | 6 votes |
@ReactMethod public void lockToLandscapeLeft() { final Activity activity = getCurrentActivity(); if (activity == null) return; activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); isLocked = true; // force send an UI orientation event lastOrientationValue = "LANDSCAPE-LEFT"; WritableMap params = Arguments.createMap(); params.putString("orientation", lastOrientationValue); if (ctx.hasActiveCatalystInstance()) { ctx .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("orientationDidChange", params); } // send a locked event WritableMap lockParams = Arguments.createMap(); lockParams.putString("orientation", lastOrientationValue); if (ctx.hasActiveCatalystInstance()) { ctx .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("lockDidChange", lockParams); } }
Example #9
Source File: ReactExoplayerView.java From react-native-video with MIT License | 6 votes |
private WritableArray getAudioTrackInfo() { WritableArray audioTracks = Arguments.createArray(); MappingTrackSelector.MappedTrackInfo info = trackSelector.getCurrentMappedTrackInfo(); int index = getTrackRendererIndex(C.TRACK_TYPE_AUDIO); if (info == null || index == C.INDEX_UNSET) { return audioTracks; } TrackGroupArray groups = info.getTrackGroups(index); for (int i = 0; i < groups.length; ++i) { Format format = groups.get(i).getFormat(0); WritableMap audioTrack = Arguments.createMap(); audioTrack.putInt("index", i); audioTrack.putString("title", format.id != null ? format.id : ""); audioTrack.putString("type", format.sampleMimeType); audioTrack.putString("language", format.language != null ? format.language : ""); audioTrack.putString("bitrate", format.bitrate == Format.NO_VALUE ? "" : String.format(Locale.US, "%.2fMbps", format.bitrate / 1000000f)); audioTracks.pushMap(audioTrack); } return audioTracks; }
Example #10
Source File: EscPosModule.java From react-native-esc-pos with MIT License | 6 votes |
@ReactMethod public void scanDevices() { scanManager.registerCallback(new ScanManager.OnBluetoothScanListener() { @Override public void deviceFound(BluetoothDevice bluetoothDevice) { WritableMap deviceInfoParams = Arguments.createMap(); deviceInfoParams.putString("name", bluetoothDevice.getName()); deviceInfoParams.putString("macAddress", bluetoothDevice.getAddress()); // put deviceInfoParams into callbackParams WritableMap callbackParams = Arguments.createMap(); callbackParams.putMap("deviceInfo", deviceInfoParams); callbackParams.putString("state", BluetoothEvent.DEVICE_FOUND.name()); // emit callback to RN code reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("bluetoothDeviceFound", callbackParams); } }); scanManager.startScan(); }
Example #11
Source File: RNStripeTerminalModule.java From react-native-stripe-terminal with MIT License | 6 votes |
WritableMap serializeReader(Reader reader) { WritableMap writableMap = Arguments.createMap(); if(reader!=null) { double batteryLevel = 0; if(reader.getBatteryLevel()!=null) batteryLevel = (double) reader.getBatteryLevel(); writableMap.putDouble(BATTERY_LEVEL, batteryLevel); int readerType = 0; if(reader.getDeviceType()!=null) readerType = reader.getDeviceType().ordinal(); writableMap.putInt(DEVICE_TYPE, readerType); String serial = ""; if(reader.getSerialNumber()!=null) serial = reader.getSerialNumber(); writableMap.putString(SERIAL_NUMBER, serial); String softwareVersion = ""; if(reader.getSoftwareVersion()!=null) softwareVersion = reader.getSoftwareVersion(); writableMap.putString(DEVICE_SOFTWARE_VERSION, softwareVersion); } return writableMap; }
Example #12
Source File: SocketsModule.java From react-native-sockets with MIT License | 6 votes |
@ReactMethod public void getIpAddress(Callback successCallback, Callback errorCallback) { WritableArray ipList = Arguments.createArray(); try { Enumeration<NetworkInterface> enumNetworkInterfaces = NetworkInterface.getNetworkInterfaces(); while (enumNetworkInterfaces.hasMoreElements()) { NetworkInterface networkInterface = enumNetworkInterfaces.nextElement(); Enumeration<InetAddress> enumInetAddress = networkInterface.getInetAddresses(); while (enumInetAddress.hasMoreElements()) { InetAddress inetAddress = enumInetAddress.nextElement(); if (inetAddress.isSiteLocalAddress()) { ipList.pushString(inetAddress.getHostAddress()); } } } } catch (SocketException e) { Log.e(eTag, "getIpAddress SocketException", e); errorCallback.invoke(e.getMessage()); } successCallback.invoke(ipList); }
Example #13
Source File: RNStripeTerminalModule.java From react-native-stripe-terminal with MIT License | 6 votes |
@ReactMethod public void collectPaymentMethod(){ pendingCreatePaymentIntent = Terminal.getInstance().collectPaymentMethod(lastPaymentIntent, this, new PaymentIntentCallback() { @Override public void onSuccess(@Nonnull PaymentIntent paymentIntent) { pendingCreatePaymentIntent = null; lastPaymentIntent = paymentIntent; WritableMap collectPaymentMethodMap = Arguments.createMap(); collectPaymentMethodMap.putMap(INTENT,serializePaymentIntent(paymentIntent,lastCurrency)); sendEventWithName(EVENT_PAYMENT_METHOD_COLLECTION,collectPaymentMethodMap); } @Override public void onFailure(@Nonnull TerminalException e) { pendingCreatePaymentIntent = null; WritableMap errorMap = Arguments.createMap(); errorMap.putString(ERROR,e.getErrorMessage()); errorMap.putInt(CODE,e.getErrorCode().ordinal()); errorMap.putMap(INTENT,serializePaymentIntent(lastPaymentIntent,lastCurrency)); sendEventWithName(EVENT_PAYMENT_METHOD_COLLECTION,errorMap); } }); }
Example #14
Source File: RNStripeTerminalModule.java From react-native-stripe-terminal with MIT License | 6 votes |
@ReactMethod public void abortInstallUpdate(){ if(pendingInstallUpdate!=null && !pendingInstallUpdate.isCompleted()){ pendingInstallUpdate.cancel(new Callback() { @Override public void onSuccess() { pendingInstallUpdate = null; sendEventWithName(EVENT_ABORT_INSTALL_COMPLETION,Arguments.createMap()); } @Override public void onFailure(@Nonnull TerminalException e) { WritableMap errorMap = Arguments.createMap(); errorMap.putString(ERROR,e.getErrorMessage()); sendEventWithName(EVENT_ABORT_INSTALL_COMPLETION,errorMap); } }); }else{ sendEventWithName(EVENT_ABORT_INSTALL_COMPLETION,Arguments.createMap()); } }
Example #15
Source File: TweetView.java From react-native-twitterkit with MIT License | 6 votes |
private void handleError() { LogUtils.d(TAG, "handleError"); if(tweetView != null) { tweetView.setVisibility(View.INVISIBLE); } WritableMap evt = Arguments.createMap(); evt.putString("message", "Could not load tweet"); ReactContext ctx = (ReactContext) getContext(); ctx.getJSModule(RCTEventEmitter.class).receiveEvent( getId(), "onLoadError", evt); }
Example #16
Source File: TelephonyModule.java From react-native-telephony with MIT License | 6 votes |
@Override public void phoneSignalStrengthsUpdated(SignalStrength signalStrength) { WritableMap map = Arguments.createMap(); map.putInt("cdmaDbm", signalStrength.getCdmaDbm()); map.putInt("cdmaEcio()", signalStrength.getCdmaEcio()); map.putInt("evdoDbm", signalStrength.getEvdoDbm()); map.putInt("evdoEcio", signalStrength.getEvdoEcio()); map.putInt("evdoSnr", signalStrength.getEvdoSnr()); map.putInt("gsmBitErrorRate", signalStrength.getGsmBitErrorRate()); map.putInt("gsmSignalStrength", signalStrength.getGsmSignalStrength()); map.putBoolean("gsm", signalStrength.isGsm()); WritableMap result = Arguments.createMap(); result.putString("type", "LISTEN_SIGNAL_STRENGTHS"); result.putMap("data", map); sendEvent(PHONE_STATE_LISTENER, result); }
Example #17
Source File: ReactNativeUtilTest.java From react-native-azurenotificationhub with MIT License | 6 votes |
@Test public void testConvertBundleToMapNullArgument() { WritableMap expectedMap = PowerMockito.mock(WritableMap.class); when(Arguments.createMap()).thenReturn(expectedMap); WritableMap map = convertBundleToMap(null); Assert.assertEquals(map, expectedMap); verify(expectedMap, times(0)).putNull(anyString()); verify(expectedMap, times(0)).putMap(anyString(), any()); verify(expectedMap, times(0)).putString(anyString(), anyString()); verify(expectedMap, times(0)).putDouble(anyString(), anyDouble()); verify(expectedMap, times(0)).putDouble(anyString(), anyFloat()); verify(expectedMap, times(0)).putInt(anyString(), anyInt()); verify(expectedMap, times(0)).putBoolean(anyString(), anyBoolean()); verify(expectedMap, times(0)).putNull(anyString()); }
Example #18
Source File: NearbyConnectionModule.java From react-native-google-nearby-connection with MIT License | 6 votes |
@Override public void onReceive(Context context, Intent intent) { if (getReactApplicationContext().hasActiveCatalystInstance()) { String serviceId = intent.getStringExtra("serviceId"); String endpointId = intent.getStringExtra("endpointId"); int payloadType = intent.getIntExtra("payloadType", -1); String payloadId = intent.getStringExtra("payloadId"); WritableMap out = Arguments.createMap(); out.putString("serviceId", serviceId); out.putString("endpointId", endpointId); out.putInt("payloadType", payloadType); out.putString("payloadId", payloadId); if (payloadType == Payload.Type.FILE) { long payloadSize = intent.getLongExtra("payloadSize", -1); out.putDouble("payloadSize", payloadSize); } sendEvent(getReactApplicationContext(), "receive_payload", out); } }
Example #19
Source File: QTalkLoaclSearch.java From imsdk-android with MIT License | 6 votes |
/** * 给rn返回搜索地址 * @param msg * @param promise */ @ReactMethod public void searchUrl(String msg,Promise promise){ WritableMap map = Arguments.createMap(); map.putBoolean("is_ok", true); map.putString("data", QtalkNavicationService.getInstance().getSearchurl()); map.putString("Msg",msg); Logger.i("QTalkLoaclSearch->"+QtalkNavicationService.getInstance().getSearchurl()); try { promise.resolve(map); }catch (Exception e){ Logger.i("QTalkLoaclSearch-searchUrl>"+e.getLocalizedMessage()); promise.reject("500",e.toString(),e); } }
Example #20
Source File: UserProfileBridge.java From react-native-lock with MIT License | 6 votes |
private void put(String key, List<?> list, WritableMap into) { if (list == null || list.isEmpty()) { return; } final WritableArray array = Arguments.createArray(); for (Object item: list) { if (item instanceof String) { array.pushString((String) item); } if (item instanceof Integer) { array.pushInt((Integer) item); } if (item instanceof Boolean) { array.pushBoolean((Boolean) item); } if (item instanceof Double) { array.pushDouble((Double) item); } if (item instanceof Date) { array.pushString(formatter.format(item)); } } into.putArray(key, array); }
Example #21
Source File: DBManager.java From react-native-android-sqlite with MIT License | 6 votes |
@ReactMethod public void query(final String sql, final ReadableArray values, final Callback callback) { new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) { @Override protected void doInBackgroundGuarded(Void ...params) { WritableArray data = Arguments.createArray(); // FLog.w(ReactConstants.TAG, "dbmanager.query.sql=%s", sql); // FLog.w(ReactConstants.TAG, "dbmanager.query.values.size()=%d", values.size()); try { data = mDb.query(sql, values); } catch(Exception e) { FLog.w(ReactConstants.TAG, "Exception in database query: ", e); callback.invoke(ErrorUtil.getError(null, e.getMessage()), null); } callback.invoke(null, data); } }.execute(); }
Example #22
Source File: RNHceModule.java From react-native-nfc-hce with Apache License 2.0 | 6 votes |
private WritableMap supportNFC() { NfcManager manager = (NfcManager) this.reactContext.getSystemService(this.reactContext.NFC_SERVICE); NfcAdapter adapter = manager.getDefaultAdapter(); WritableMap map = Arguments.createMap(); if (adapter != null) { map.putBoolean("support", true); if (adapter.isEnabled()) { map.putBoolean("enabled", true); } else { map.putBoolean("enabled", false); } } else { map.putBoolean("support", false); map.putBoolean("enabled", false); } return map; }
Example #23
Source File: ReactRootView.java From react-native-GPay with MIT License | 5 votes |
private void emitOrientationChanged(final int newRotation) { String name; double rotationDegrees; boolean isLandscape = false; switch (newRotation) { case Surface.ROTATION_0: name = "portrait-primary"; rotationDegrees = 0.0; break; case Surface.ROTATION_90: name = "landscape-primary"; rotationDegrees = -90.0; isLandscape = true; break; case Surface.ROTATION_180: name = "portrait-secondary"; rotationDegrees = 180.0; break; case Surface.ROTATION_270: name = "landscape-secondary"; rotationDegrees = 90.0; isLandscape = true; break; default: return; } WritableMap map = Arguments.createMap(); map.putString("name", name); map.putDouble("rotationDegrees", rotationDegrees); map.putBoolean("isLandscape", isLandscape); sendEvent("namedOrientationDidChange", map); }
Example #24
Source File: FloatingVideoWidgetShowService.java From rn-floating-video-widget with MIT License | 5 votes |
public void onPause(View view) { long seek = videoView.getCurrentPosition(); playVideo.setVisibility(ImageButton.VISIBLE); pauseVideo.setVisibility(ImageButton.GONE); videoView.pause(); WritableMap args = Arguments.createMap(); args.putInt("index", index); args.putInt("seek", (int) seek); args.putString("type", "paused"); args.putString("url", playingVideo.getString("url")); sendEvent(reactContext, "onPause", args); }
Example #25
Source File: FloatingVideoWidgetShowService.java From rn-floating-video-widget with MIT License | 5 votes |
public void onResume(View view) { long seek = videoView.getCurrentPosition(); playVideo.setVisibility(ImageButton.GONE); pauseVideo.setVisibility(ImageButton.VISIBLE); videoView.start(); WritableMap args = Arguments.createMap(); args.putInt("index", index); args.putInt("seek", (int) seek); args.putString("type", "resume"); args.putString("url", playingVideo.getString("url")); sendEvent(reactContext, "onPlay", args); }
Example #26
Source File: RNYandexMapKitView.java From react-native-yandexmapkit with MIT License | 5 votes |
@Override public void onMapActionEvent(MapEvent mapEvent) { MapController controller = getMapController(); GeoPoint mapCenter = controller.getMapCenter(); int msg = mapEvent.getMsg(); if (mGeocodingEnabled && msg == MapEvent.MSG_SCALE_END || msg == MapEvent.MSG_SCROLL_END || msg == MapEvent.MSG_ZOOM_END){ controller.getDownloader().getGeoCode(this, mapCenter); } Rect viewport = controller.getViewport(); if (viewport.width() == 0 || viewport.height() == 0) return; GeoPoint topLeft = controller.getGeoPoint(new ScreenPoint(viewport.left, viewport.top)); GeoPoint bottomRight = controller.getGeoPoint(new ScreenPoint(viewport.right, viewport.bottom)); double latDelta = Math.abs(bottomRight.getLat() - topLeft.getLat()); double lonDelta = Math.abs(bottomRight.getLon() - topLeft.getLon()); WritableMap payload = Arguments.createMap(); payload.putInt("type", msg); payload.putDouble("latitude", mapCenter.getLat()); payload.putDouble("longitude", mapCenter.getLon()); payload.putDouble("latitudeDelta", latDelta); payload.putDouble("longitudeDelta", lonDelta); ReactContext reactContext = (ReactContext) getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(this.getId(), MAP_EVENT, payload); }
Example #27
Source File: RNUnifiedContactsModule.java From react-native-unified-contacts with MIT License | 5 votes |
@NonNull private WritableMap getNamesFromContact(int contactId) { WritableMap names = Arguments.createMap(); String whereString = ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?"; String[] whereParams = new String[]{String.valueOf(contactId), ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE }; Cursor namesCursor = contentResolver.query( ContactsContract.Data.CONTENT_URI, null, whereString, whereParams, null, null); if ( !namesCursor.moveToFirst() ) return names; String prefix = getStringFromCursor( namesCursor, ContactsContract.CommonDataKinds.StructuredName.PREFIX ); String givenName = getStringFromCursor( namesCursor, ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME ); String middleName = getStringFromCursor( namesCursor, ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME ); String familyName = getStringFromCursor( namesCursor, ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME ); String suffix = getStringFromCursor( namesCursor, ContactsContract.CommonDataKinds.StructuredName.SUFFIX ); String displayName = getStringFromCursor( namesCursor, ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME ); names.putString( "prefix", prefix ); names.putString( "givenName", givenName ); names.putString( "middleName", middleName ); names.putString( "familyName", familyName ); names.putString( "suffix", suffix ); names.putString( "displayName", displayName ); names.putString( "fullName", displayName ); namesCursor.close(); return names; }
Example #28
Source File: RNRtmpView.java From react-native-rtmpview with MIT License | 5 votes |
public void onLoadStateChanged(RNRtmpLoadState loadState) { WritableMap event = Arguments.createMap(); event.putString("state", loadState.getFieldDescription()); ReactContext reactContext = (ReactContext)getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( getId(), Events.EVENT_LOAD_STATE.toString(), event); }
Example #29
Source File: RCTTwilioChatClient.java From react-native-twilio-chat with MIT License | 5 votes |
@Override public void onToastFailed(ErrorInfo errorInfo) { WritableMap map = Arguments.createMap(); map.putString("error",errorInfo.getErrorText()); map.putString("userInfo", errorInfo.toString()); sendEvent("chatClient:toastFailed", map); }
Example #30
Source File: IntercomEventEmitter.java From react-native-intercom with MIT License | 5 votes |
private void handleUpdateUnreadCount() { try { WritableMap params = Arguments.createMap(); params.putInt("count", Intercom.client().getUnreadConversationCount()); sendEvent(UNREAD_CHANGE_NOTIFICATION, params); } catch (Exception e) { Log.e(TAG, "client called before Intercom initialization"); } }