Search in sources :

Example 61 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fcm by evollu.

the class FIRMessagingModule method send.

@ReactMethod
public void send(String senderId, ReadableMap payload) throws Exception {
    FirebaseMessaging fm = FirebaseMessaging.getInstance();
    RemoteMessage.Builder message = new RemoteMessage.Builder(senderId + "@gcm.googleapis.com").setMessageId(UUID.randomUUID().toString());
    ReadableMapKeySetIterator iterator = payload.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        String value = getStringFromReadableMap(payload, key);
        message.addData(key, value);
    }
    fm.send(message.build());
}
Also used : ReadableMapKeySetIterator(com.facebook.react.bridge.ReadableMapKeySetIterator) RemoteMessage(com.google.firebase.messaging.RemoteMessage) FirebaseMessaging(com.google.firebase.messaging.FirebaseMessaging) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 62 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fcm by evollu.

the class FIRMessagingModule method getScheduledLocalNotifications.

@ReactMethod
public void getScheduledLocalNotifications(Promise promise) {
    ArrayList<Bundle> bundles = mFIRLocalMessagingHelper.getScheduledLocalNotifications();
    WritableArray array = Arguments.createArray();
    for (Bundle bundle : bundles) {
        array.pushMap(Arguments.fromBundle(bundle));
    }
    promise.resolve(array);
}
Also used : WritableArray(com.facebook.react.bridge.WritableArray) Bundle(android.os.Bundle) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 63 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-navigation by wix.

the class NavigationModule method showOverlay.

@ReactMethod
public void showOverlay(String commandId, ReadableMap rawLayoutTree, Promise promise) {
    final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree));
    handle(() -> {
        final ViewController<?> viewController = layoutFactory.create(layoutTree);
        navigator().showOverlay(viewController, new NativeCommandListener("showOverlay", commandId, promise, eventEmitter, now));
    });
}
Also used : LayoutNode(com.reactnativenavigation.options.LayoutNode) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 64 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-camera by lwansbrough.

the class RCTCameraModule method hasFlash.

@ReactMethod
public void hasFlash(ReadableMap options, final Promise promise) {
    Camera camera = RCTCamera.getInstance().acquireCameraInstance(options.getInt("type"));
    if (null == camera) {
        promise.reject("No camera found.");
        return;
    }
    List<String> flashModes = camera.getParameters().getSupportedFlashModes();
    promise.resolve(null != flashModes && !flashModes.isEmpty());
}
Also used : Camera(android.hardware.Camera) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 65 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-orientation-locker by wonday.

the class OrientationModule method getAutoRotateState.

@ReactMethod
public void getAutoRotateState(Callback callback) {
    final ContentResolver resolver = ctx.getContentResolver();
    boolean rotateLock = android.provider.Settings.System.getInt(resolver, android.provider.Settings.System.ACCELEROMETER_ROTATION, 0) == 1;
    callback.invoke(rotateLock);
}
Also used : ContentResolver(android.content.ContentResolver) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

ReactMethod (com.facebook.react.bridge.ReactMethod)87 Activity (android.app.Activity)21 WritableMap (com.facebook.react.bridge.WritableMap)17 Intent (android.content.Intent)10 Bundle (android.os.Bundle)10 ReactApplicationContext (com.facebook.react.bridge.ReactApplicationContext)6 WritableArray (com.facebook.react.bridge.WritableArray)5 ArrayList (java.util.ArrayList)5 Camera (android.hardware.Camera)4 InterstitialAd (com.facebook.ads.InterstitialAd)4 ShareContent (com.facebook.share.model.ShareContent)4 LayoutNode (com.reactnativenavigation.options.LayoutNode)4 LoginManager (com.facebook.login.LoginManager)3 ReactActivity (com.facebook.react.ReactActivity)3 LatLng (com.google.android.gms.maps.model.LatLng)3 NotificationManager (android.app.NotificationManager)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 RemoteException (android.os.RemoteException)2 NativeAdsManager (com.facebook.ads.NativeAdsManager)2 JSApplicationIllegalArgumentException (com.facebook.react.bridge.JSApplicationIllegalArgumentException)2