com.getcapacitor.PluginCall.resolve()

Here are the examples of the java api com.getcapacitor.PluginCall.resolve() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

55 Examples 7

19 Source : DownloaderPlugin.java
with MIT License
from triniwiz

@PluginMethod()
public static void setTimeout(PluginCall call) {
    timeout = call.getInt("timeout", 60);
    call.resolve();
}

19 Source : DownloaderPlugin.java
with MIT License
from triniwiz

@PluginMethod()
public void getStatus(PluginCall call) {
    String id = call.getString("id");
    DownloadData data = downloadsData.get(id);
    JSObject jsObject = new JSObject();
    if (data != null) {
        jsObject.put("value", data.getStatus());
    }
    call.resolve(jsObject);
}

19 Source : DownloaderPlugin.java
with MIT License
from triniwiz

@PluginMethod()
public void createDownload(PluginCall call) {
    Manager manager = Manager.getInstance();
    String url = call.getString("url");
    String query = call.getString("query");
    JSObject headers = call.getObject("headers");
    String path = call.getString("path");
    String fileName = call.getString("fileName");
    Request request = new Request(url);
    request.setTimeout(timeout);
    DownloadData data = new DownloadData();
    if (query != null) {
    // TODO
    }
    if (headers != null) {
        HashMap<String, String> map = new HashMap<String, String>();
        int len = headers.length();
        Iterator<String> keys = headers.keys();
        for (int i = 0; i < len; i++) {
            String key = keys.next();
            map.put(key, headers.getString(key));
        }
        request.setHeaders(map);
    }
    if (path != null) {
        request.setFilePath(path);
        data.setPath(path);
    }
    if (fileName != null) {
        request.setFileName(fileName);
    }
    String id = manager.create(request);
    downloadsRequest.put(id, request);
    JSObject object = new JSObject();
    object.put("value", id);
    downloadsData.put(id, data);
    call.resolve(object);
}

19 Source : DownloaderPlugin.java
with MIT License
from triniwiz

@PluginMethod()
public void getPath(PluginCall call) {
    String id = call.getString("id");
    DownloadData data = downloadsData.get(id);
    JSObject jsObject = new JSObject();
    if (data != null) {
        jsObject.put("value", data.getPath());
    }
    call.resolve(jsObject);
}

19 Source : ResourceUrlAsyncTask.java
with MIT License
from moberwasserlechner

@Override
protected void onPostExecute(ResourceCallResult response) {
    if (response != null) {
        if (!response.isError()) {
            pluginCall.resolve(response.getResponse());
        } else {
            Log.e(logTag, response.getErrorMsg());
            pluginCall.reject(ERR_GENERAL);
        }
    } else {
        pluginCall.reject(ERR_GENERAL);
    }
}

19 Source : OAuth2ClientPlugin.java
with MIT License
from moberwasserlechner

void createJsObjAndResolve(PluginCall call, String jsonStr) {
    try {
        JSObject json = new JSObject(jsonStr);
        call.resolve(json);
    } catch (JSONException e) {
        call.reject(ERR_GENERAL, e);
    }
}

19 Source : OAuth2ClientPlugin.java
with MIT License
from moberwasserlechner

@PluginMethod()
public void logout(final PluginCall call) {
    String customHandlerClreplacedname = ConfigUtils.getParam(String.clreplaced, call.getData(), PARAM_ANDROID_CUSTOM_HANDLER_CLreplaced);
    if (customHandlerClreplacedname != null && customHandlerClreplacedname.length() > 0) {
        try {
            Clreplaced<OAuth2CustomHandler> handlerClreplaced = (Clreplaced<OAuth2CustomHandler>) Clreplaced.forName(customHandlerClreplacedname);
            OAuth2CustomHandler handler = handlerClreplaced.newInstance();
            boolean successful = handler.logout(getActivity(), call);
            if (successful) {
                call.resolve();
            } else {
                call.reject(ERR_CUSTOM_HANDLER_LOGOUT);
            }
        } catch (InstantiationException | IllegalAccessException | ClreplacedNotFoundException e) {
            call.reject(ERR_CUSTOM_HANDLER_LOGOUT, e);
        } catch (Exception e) {
            call.reject(ERR_GENERAL, e);
        }
    } else {
        this.disposeAuthService();
        this.discardAuthState();
        call.resolve();
    }
}

19 Source : OAuth2ClientPlugin.java
with MIT License
from moberwasserlechner

@PluginMethod()
public void refreshToken(final PluginCall call) {
    disposeAuthService();
    OAuth2RefreshTokenOptions oAuth2RefreshTokenOptions = buildRefreshTokenOptions(call.getData());
    if (oAuth2RefreshTokenOptions.getAppId() == null) {
        call.reject(ERR_PARAM_NO_APP_ID);
        return;
    }
    if (oAuth2RefreshTokenOptions.getAccessTokenEndpoint() == null) {
        call.reject(ERR_PARAM_NO_ACCESS_TOKEN_ENDPOINT);
        return;
    }
    if (oAuth2RefreshTokenOptions.getRefreshToken() == null) {
        call.reject(ERR_PARAM_NO_REFRESH_TOKEN);
        return;
    }
    this.authService = new AuthorizationService(getContext());
    AuthorizationServiceConfiguration config = new AuthorizationServiceConfiguration(Uri.parse(""), Uri.parse(oAuth2RefreshTokenOptions.getAccessTokenEndpoint()));
    if (this.authState == null) {
        this.authState = new AuthState(config);
    }
    TokenRequest tokenRequest = new TokenRequest.Builder(config, oAuth2RefreshTokenOptions.getAppId()).setGrantType(GrantTypeValues.REFRESH_TOKEN).setScope(oAuth2RefreshTokenOptions.getScope()).setRefreshToken(oAuth2RefreshTokenOptions.getRefreshToken()).build();
    this.authService.performTokenRequest(tokenRequest, (response1, ex) -> {
        this.authState.update(response1, ex);
        if (ex != null) {
            call.reject(ERR_GENERAL, ex);
        } else {
            if (response1 != null) {
                try {
                    JSObject json = new JSObject(response1.jsonSerializeString());
                    call.resolve(json);
                } catch (JSONException e) {
                    call.reject(ERR_GENERAL, e);
                }
            } else {
                call.reject(ERR_NO_ACCESS_TOKEN);
            }
        }
    });
}

19 Source : FileSharerPlugin.java
with MIT License
from moberwasserlechner

@Override
protected void handleOnActivityResult(int requestCode, int resultCode, Intent data) {
    super.handleOnActivityResult(requestCode, resultCode, data);
    if (requestCode == SEND_REQUEST_CODE) {
        PluginCall call = getSavedCall();
        call.resolve();
    }
}

19 Source : SecureStoragePlugin.java
with MIT License
from martinkasa

@PluginMethod()
public void getPlatform(PluginCall call) {
    call.resolve(this._getPlatform());
}

19 Source : SecureStoragePlugin.java
with MIT License
from martinkasa

@PluginMethod()
public void clear(PluginCall call) {
    try {
        call.resolve(this._clear());
    } catch (Exception exception) {
        call.reject(exception.getMessage(), exception);
    }
}

19 Source : SecureStoragePlugin.java
with MIT License
from martinkasa

@PluginMethod()
public void keys(PluginCall call) {
    call.resolve(this._keys());
}

19 Source : SecureStoragePlugin.java
with MIT License
from martinkasa

@PluginMethod()
public void get(PluginCall call) {
    String key = call.getString("key");
    try {
        call.resolve(this._get(key));
    } catch (Exception exception) {
        call.reject(exception.getMessage(), exception);
    }
}

19 Source : SecureStoragePlugin.java
with MIT License
from martinkasa

@PluginMethod()
public void set(PluginCall call) {
    String key = call.getString("key");
    String value = call.getString("value");
    try {
        call.resolve(this._set(key, value));
    } catch (Exception exception) {
        call.reject(exception.getMessage(), exception);
    }
}

19 Source : SecureStoragePlugin.java
with MIT License
from martinkasa

@PluginMethod()
public void remove(PluginCall call) {
    String key = call.getString("key");
    try {
        call.resolve(this._remove(key));
    } catch (Exception exception) {
        call.reject(exception.getMessage(), exception);
    }
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void settings(final PluginCall call) {
    final boolean allowScrollGesturesDuringRotateOrZoom = call.getBoolean("allowScrollGesturesDuringRotateOrZoom", true);
    final boolean compreplacedButton = call.getBoolean("compreplacedButton", false);
    final boolean zoomButton = call.getBoolean("zoomButton", true);
    final boolean myLocationButton = call.getBoolean("myLocationButton", false);
    boolean consumesGesturesInView = call.getBoolean("consumesGesturesInView", true);
    final boolean indoorPicker = call.getBoolean("indoorPicker", false);
    final boolean rotateGestures = call.getBoolean("rotateGestures", true);
    final boolean scrollGestures = call.getBoolean("scrollGestures", true);
    final boolean tiltGestures = call.getBoolean("tiltGestures", true);
    final boolean zoomGestures = call.getBoolean("zoomGestures", true);
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            UiSettings googleMapUISettings = googleMap.getUiSettings();
            googleMapUISettings.setScrollGesturesEnabledDuringRotateOrZoom(allowScrollGesturesDuringRotateOrZoom);
            googleMapUISettings.setCompreplacedEnabled(compreplacedButton);
            googleMapUISettings.setIndoorLevelPickerEnabled(indoorPicker);
            googleMapUISettings.setMyLocationButtonEnabled(myLocationButton);
            googleMapUISettings.setRotateGesturesEnabled(rotateGestures);
            googleMapUISettings.setScrollGesturesEnabled(scrollGestures);
            googleMapUISettings.setTiltGesturesEnabled(tiltGestures);
            googleMapUISettings.setZoomGesturesEnabled(zoomGestures);
            googleMapUISettings.setZoomControlsEnabled(zoomButton);
            googleMapUISettings.setMyLocationButtonEnabled(true);
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void setOnMapClickListener(PluginCall call) {
    final CapacitorGoogleMaps ctx = this;
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {

                @Override
                public void onMapClick(LatLng latLng) {
                    ctx.onMapClick(latLng);
                }
            });
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void setOnMyLocationClickListener(PluginCall call) {
    final CapacitorGoogleMaps ctx = this;
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            googleMap.setOnMyLocationClickListener(new GoogleMap.OnMyLocationClickListener() {

                @Override
                public void onMyLocationClick(@NonNull Location location) {
                    ctx.onMyLocationClick(location);
                }
            });
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void setCamera(PluginCall call) {
    final float viewingAngle = call.getFloat("viewingAngle", googleMap.getCameraPosition().tilt);
    final float bearing = call.getFloat("bearing", googleMap.getCameraPosition().bearing);
    final Float zoom = call.getFloat("zoom", googleMap.getCameraPosition().zoom);
    final Double lareplacedude = call.getDouble("lareplacedude", googleMap.getCameraPosition().target.lareplacedude);
    final Double longitude = call.getDouble("longitude", googleMap.getCameraPosition().target.longitude);
    final Boolean animate = call.getBoolean("animate", false);
    Double animationDuration = call.getDouble("animationDuration", 1000.0);
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(lareplacedude, longitude)).zoom(zoom).tilt(viewingAngle).bearing(bearing).build();
            if (animate) {
                /*
                     * TODO: Implement animationDuration
                     * */
                googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
            } else {
                googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
            }
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void hasLocationPermission(PluginCall call) {
    Context ctx = getBridge().getContext();
    if (ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        locationPermissionGranted = true;
    } else {
        locationPermissionGranted = false;
    }
    JSObject result = new JSObject();
    result.put("locationPermissionGranted", locationPermissionGranted);
    call.resolve(result);
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void requestLocationPermission(PluginCall call) {
    ActivityCompat.requestPermissions(getBridge().getActivity(), new String[] { android.Manifest.permission.ACCESS_FINE_LOCATION }, PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);
    JSObject result = new JSObject();
    result.put("locationPermissionRequested", true);
    call.resolve(result);
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void addMarker(PluginCall call) {
    final Double lareplacedude = call.getDouble("lareplacedude", 0d);
    final Double longitude = call.getDouble("longitude", 0d);
    final Float opacity = call.getFloat("opacity", 1.0f);
    final String replacedle = call.getString("replacedle", "");
    final String snippet = call.getString("snippet", "");
    final Boolean isFlat = call.getBoolean("isFlat", true);
    getBridge().getActivity().runOnUiThread(new Runnable() {

        @Override
        public void run() {
            LatLng latLng = new LatLng(lareplacedude, longitude);
            MarkerOptions markerOptions = new MarkerOptions();
            markerOptions.position(latLng);
            markerOptions.alpha(opacity);
            markerOptions.replacedle(replacedle);
            markerOptions.snippet(snippet);
            markerOptions.flat(isFlat);
            googleMap.addMarker(markerOptions);
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void setOnPoiClickListener(PluginCall call) {
    final CapacitorGoogleMaps ctx = this;
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            googleMap.setOnPoiClickListener(new GoogleMap.OnPoiClickListener() {

                @Override
                public void onPoiClick(PointOfInterest pointOfInterest) {
                    ctx.onPoiClick(pointOfInterest);
                }
            });
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void setOnMyLocationButtonClickListener(PluginCall call) {
    final CapacitorGoogleMaps ctx = this;
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            googleMap.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {

                @Override
                public boolean onMyLocationButtonClick() {
                    ctx.onMyLocationButtonClick();
                    return false;
                }
            });
        }
    });
    call.resolve();
}

19 Source : CapacitorGoogleMaps.java
with MIT License
from hemangsk

@PluginMethod()
public void setOnMarkerClickListener(PluginCall call) {
    final CapacitorGoogleMaps ctx = this;
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {

                @Override
                public boolean onMarkerClick(Marker marker) {
                    ctx.onMarkerClick(marker);
                    return false;
                }
            });
        }
    });
    call.resolve();
}

19 Source : Storage.java
with MIT License
from DoFabien

@PluginMethod()
public void get(PluginCall call) {
    String key = call.getString("key");
    if (key == null) {
        call.reject("Must provide key");
        return;
    }
    String value = prefs.getString(key, null);
    JSObject ret = new JSObject();
    ret.put("value", value == null ? JSObject.NULL : value);
    call.resolve(ret);
}

19 Source : Storage.java
with MIT License
from DoFabien

@PluginMethod()
public void remove(PluginCall call) {
    String key = call.getString("key");
    if (key == null) {
        call.reject("Must provide key");
        return;
    }
    editor.remove(key);
    editor.apply();
    call.resolve();
}

19 Source : Storage.java
with MIT License
from DoFabien

@PluginMethod()
public void keys(PluginCall call) {
    Map<String, ?> values = prefs.getAll();
    Set<String> keys = values.keySet();
    String[] keyArray = keys.toArray(new String[keys.size()]);
    JSObject ret = new JSObject();
    try {
        ret.put("keys", new JSArray(keyArray));
    } catch (JSONException ex) {
        call.reject("Unable to create key array.");
        return;
    }
    call.resolve(ret);
}

19 Source : Storage.java
with MIT License
from DoFabien

@PluginMethod()
public void set(PluginCall call) {
    String key = call.getString("key");
    if (key == null) {
        call.reject("Must provide key");
        return;
    }
    String value = call.getString("value");
    editor.putString(key, value);
    editor.apply();
    call.resolve();
}

19 Source : Storage.java
with MIT License
from DoFabien

@PluginMethod()
public void clear(PluginCall call) {
    editor.clear();
    editor.apply();
    call.resolve();
}

19 Source : StatusBar.java
with MIT License
from DoFabien

@PluginMethod()
public void getInfo(final PluginCall call) {
    View decorView = getActivity().getWindow().getDecorView();
    Window window = getActivity().getWindow();
    String style;
    if ((decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) == View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) {
        style = "LIGHT";
    } else {
        style = "DARK";
    }
    JSObject data = new JSObject();
    data.put("visible", (decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_FULLSCREEN) != View.SYSTEM_UI_FLAG_FULLSCREEN);
    data.put("style", style);
    data.put("color", String.format("#%06X", (0xFFFFFF & window.getStatusBarColor())));
    call.resolve(data);
}

19 Source : Permissions.java
with MIT License
from DoFabien

private void checkNotifications(PluginCall call) {
    boolean areEnabled = NotificationManagerCompat.from(getContext()).areNotificationsEnabled();
    JSObject ret = new JSObject();
    ret.put("state", areEnabled ? "granted" : "denied");
    call.resolve(ret);
}

19 Source : Permissions.java
with MIT License
from DoFabien

private void checkClipboard(PluginCall call) {
    JSObject ret = new JSObject();
    ret.put("state", "granted");
    call.resolve(ret);
}

19 Source : Permissions.java
with MIT License
from DoFabien

private void checkPerm(String perm, PluginCall call) {
    JSObject ret = new JSObject();
    if (ContextCompat.checkSelfPermission(getContext(), perm) == PackageManager.PERMISSION_DENIED) {
        ret.put("state", "denied");
    } else if (ContextCompat.checkSelfPermission(getContext(), perm) == PackageManager.PERMISSION_GRANTED) {
        ret.put("state", "granted");
    } else {
        ret.put("state", "prompt");
    }
    call.resolve(ret);
}

19 Source : Geolocation.java
with MIT License
from DoFabien

@Override
protected void handleRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.handleRequestPermissionsResult(requestCode, permissions, grantResults);
    PluginCall savedCall = getSavedCall();
    if (savedCall == null) {
        return;
    }
    for (int result : grantResults) {
        if (result == PackageManager.PERMISSION_DENIED) {
            savedCall.error("User denied location permission");
            return;
        }
    }
    if (savedCall.getMethodName().equals("getCurrentPosition")) {
        sendLocation(savedCall);
    } else if (savedCall.getMethodName().equals("watchPosition")) {
        starreplacedch(savedCall);
    } else {
        savedCall.resolve();
        savedCall.release(bridge);
    }
}

19 Source : CameraPreview.java
with MIT License
from capacitor-community

@PluginMethod
public void flip(PluginCall call) {
    try {
        fragment.switchCamera();
        call.resolve();
    } catch (Exception e) {
        call.reject("failed to flip camera");
    }
}

19 Source : BannerAd.java
with MIT License
from admob-plus

public void hide(AdMobPlusPlugin plugin, PluginCall call) {
    if (adView != null) {
        adView.pause();
        adView.setVisibility(View.GONE);
    }
    call.resolve();
}

19 Source : GoogleFit.java
with MIT License
from Ad-Scientiam

@Override
protected void handleOnActivityResult(int requestCode, int resultCode, Intent data) {
    super.handleOnActivityResult(requestCode, resultCode, data);
    PluginCall savedCall = getSavedCall();
    if (requestCode == GOOGLE_FIT_PERMISSIONS_REQUEST_CODE) {
        savedCall.resolve();
    } else if (requestCode == RC_SIGN_IN) {
        if (!GoogleSignIn.hasPermissions(this.getAccount(), getFitnessSignInOptions())) {
            this.requestPermissions();
        } else {
            savedCall.resolve();
        }
    }
}

19 Source : GoogleFit.java
with MIT License
from Ad-Scientiam

@PluginMethod()
public void isAllowed(PluginCall call) {
    final JSObject result = new JSObject();
    GoogleSignInAccount account = getAccount();
    if (account != null && GoogleSignIn.hasPermissions(account, getFitnessSignInOptions())) {
        result.put("allowed", true);
    } else {
        result.put("allowed", false);
    }
    call.resolve(result);
}

18 Source : TextToSpeechPlugin.java
with MIT License
from capacitor-community

@PluginMethod
public void getSupportedLanguages(PluginCall call) {
    try {
        JSArray languages = implementation.getSupportedLanguages();
        JSObject ret = new JSObject();
        ret.put("languages", languages);
        call.resolve(ret);
    } catch (Exception ex) {
        call.reject(ex.getLocalizedMessage());
    }
}

18 Source : TextToSpeechPlugin.java
with MIT License
from capacitor-community

@PluginMethod
public void getSupportedVoices(PluginCall call) {
    try {
        JSArray voices = implementation.getSupportedVoices();
        JSObject ret = new JSObject();
        ret.put("voices", voices);
        call.resolve(ret);
    } catch (Exception ex) {
        call.reject(ex.getLocalizedMessage());
    }
}

18 Source : TextToSpeechPlugin.java
with MIT License
from capacitor-community

@PluginMethod
public void openInstall(PluginCall call) {
    try {
        implementation.openInstall();
        call.resolve();
    } catch (Exception ex) {
        call.reject(ex.getLocalizedMessage());
    }
}

18 Source : TextToSpeechPlugin.java
with MIT License
from capacitor-community

@PluginMethod
public void stop(PluginCall call) {
    boolean isAvailable = implementation.isAvailable();
    if (!isAvailable) {
        call.unavailable("Not yet initialized or not available on this device.");
        return;
    }
    try {
        implementation.stop();
        call.resolve();
    } catch (Exception ex) {
        call.reject(ex.getLocalizedMessage());
    }
}

18 Source : BarcodeScanner.java
with MIT License
from capacitor-community

void _checkPermission(PluginCall call, boolean force) {
    this.savedReturnObject = new JSObject();
    if (hasPermission(PERMISSION_NAME)) {
        // permission GRANTED
        this.savedReturnObject.put(GRANTED, true);
    } else {
        // permission NOT YET GRANTED
        // check if asked before
        boolean neverAsked = isPermissionFirstTimeAsking(PERMISSION_NAME);
        if (neverAsked) {
            this.savedReturnObject.put(NEVER_ASKED, true);
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            // from version Android M on,
            // on runtime,
            // each permission can be temporarily denied,
            // or be denied forever
            if (neverAsked || getActivity().shouldShowRequestPermissionRationale(PERMISSION_NAME)) {
                // permission never asked before
                // OR
                // permission DENIED, BUT not for always
                // So
                // can be asked (again)
                if (force) {
                    // request permission
                    // also set this.savedCall = call
                    // so a callback can be made from the handleRequestPermissionsResult
                    pluginRequestPermission(PERMISSION_NAME, REQUEST_CODE);
                    this.savedCall = call;
                    return;
                }
            } else {
                // permission DENIED
                // user ALSO checked "NEVER ASK AGAIN"
                this.savedReturnObject.put(DENIED, true);
            }
        } else {
            // below android M
            // no runtime permissions exist
            // so always
            // permission GRANTED
            this.savedReturnObject.put(GRANTED, true);
        }
    }
    call.resolve(this.savedReturnObject);
}

18 Source : RewardedAd.java
with MIT License
from admob-plus

public void show(AdMobPlusPlugin plugin, PluginCall call) {
    if (!isLoaded()) {
        return;
    }
    mRewardedAd.show(plugin.getActivity(), new OnUserEarnedRewardListener() {

        @Override
        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
            // Handle the reward.
            int rewardAmount = rewardItem.getAmount();
            String rewardType = rewardItem.getType();
        }
    });
    call.resolve();
}

18 Source : InterstitialAd.java
with MIT License
from admob-plus

public void show(AdMobPlusPlugin plugin, PluginCall call) {
    if (isLoaded()) {
        mIntersreplacedialAd.show(plugin.getActivity());
    }
    call.resolve();
}

18 Source : BannerAd.java
with MIT License
from admob-plus

public void show(AdMobPlusPlugin plugin, PluginCall call, AdRequest adRequest) {
    WebView webView = plugin.getBridge().getWebView();
    if (adView == null) {
        adView = new AdView(plugin.getActivity());
        adView.setAdUnitId(adUnitId);
        adView.setAdSize(adSize);
        adView.setAdListener(new AdListener() {

            @Override
            public void onAdClicked() {
            }

            @Override
            public void onAdClosed() {
            }

            @Override
            public void onAdFailedToLoad(LoadAdError error) {
            }

            @Override
            public void onAdImpression() {
            }

            @Override
            public void onAdLoaded() {
            }

            @Override
            public void onAdOpened() {
            }
        });
        addBannerView(plugin, adView);
    } else if (adView.getVisibility() == View.GONE) {
        adView.resume();
        adView.setVisibility(View.VISIBLE);
    } else {
        ViewGroup wvParentView = (ViewGroup) webView.getParent();
        if (parentView != wvParentView) {
            parentView.removeAllViews();
            if (parentView.getParent() != null) {
                ((ViewGroup) parentView.getParent()).removeView(parentView);
            }
            addBannerView(plugin, adView);
        }
    }
    adView.loadAd(adRequest);
    call.resolve();
}

17 Source : BarcodeScanner.java
with MIT License
from capacitor-community

@PluginMethod
public void prepare(PluginCall call) {
    prepare();
    call.resolve();
}

17 Source : BarcodeScanner.java
with MIT License
from capacitor-community

@PluginMethod
public void stopScan(PluginCall call) {
    destroy();
    call.resolve();
}

17 Source : BarcodeScanner.java
with MIT License
from capacitor-community

@PluginMethod
public void hideBackground(PluginCall call) {
    hideBackground();
    call.resolve();
}

See More Examples