Search in sources :

Example 71 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fbads by callstack.

the class InterstitialAdManager method loadAd.

@ReactMethod
public void loadAd(String placementId, Promise p) {
    ReactApplicationContext reactContext = this.getReactApplicationContext();
    mViewAtOnce = true;
    mPromise = p;
    mInterstitial = new InterstitialAd(reactContext, placementId);
    mInterstitial.loadAd();
}
Also used : InterstitialAd(com.facebook.ads.InterstitialAd) ReactApplicationContext(com.facebook.react.bridge.ReactApplicationContext) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 72 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fbads by callstack.

the class NativeAdManager method init.

/**
 * Initialises native ad manager for a given placement id and ads to request.
 * This method is run on the UI thread
 *
 * @param placementId
 * @param adsToRequest
 */
@ReactMethod
public void init(final String placementId, final int adsToRequest) {
    final ReactApplicationContext reactContext = this.getReactApplicationContext();
    UiThreadUtil.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            final NativeAdsManager adsManager = new NativeAdsManager(reactContext, placementId, adsToRequest);
            adsManager.setListener(NativeAdManager.this);
            mAdsManagers.put(placementId, adsManager);
            adsManager.loadAds();
        }
    });
}
Also used : ReactApplicationContext(com.facebook.react.bridge.ReactApplicationContext) NativeAdsManager(com.facebook.ads.NativeAdsManager) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 73 with ReactMethod

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

the class NavigatorModule method pushNative.

@SuppressWarnings({ "UnusedParameters", "unused" })
@ReactMethod
public void pushNative(String name, ReadableMap props, ReadableMap options, Promise promise) {
    Activity activity = getCurrentActivity();
    if (activity == null) {
        return;
    }
    Intent intent = coordinator.intentForKey(activity.getBaseContext(), name, props);
    startActivityWithPromise(activity, intent, promise, options);
}
Also used : Activity(android.app.Activity) Intent(android.content.Intent) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 74 with ReactMethod

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

the class NavigatorModule method presentNative.

@SuppressWarnings({ "UnusedParameters", "unused" })
@ReactMethod
public void presentNative(String name, ReadableMap props, ReadableMap options, Promise promise) {
    Activity activity = getCurrentActivity();
    if (activity == null) {
        return;
    }
    Intent intent = coordinator.intentForKey(activity.getBaseContext(), name, props);
    startActivityWithPromise(activity, intent, promise, options);
}
Also used : Activity(android.app.Activity) Intent(android.content.Intent) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 75 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-twilio-programmable-voice by hoxfon.

the class TwilioVoiceModule method initWithAccessToken.

@ReactMethod
public void initWithAccessToken(final String accessToken, Promise promise) {
    if (accessToken.equals("")) {
        promise.reject(new JSApplicationIllegalArgumentException("Invalid access token"));
        return;
    }
    TwilioVoiceModule.this.accessToken = accessToken;
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "initWithAccessToken ACTION_FCM_TOKEN");
    }
    registerForCallInvites();
    WritableMap params = Arguments.createMap();
    params.putBoolean("initialized", true);
    promise.resolve(params);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) JSApplicationIllegalArgumentException(com.facebook.react.bridge.JSApplicationIllegalArgumentException) 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