Search in sources :

Example 26 with PluginMethod

use of com.getcapacitor.PluginMethod in project admob-plus by admob-plus.

the class AdMobPlusPlugin method adHide.

@PluginMethod
public void adHide(PluginCall call) {
    final ExecuteContext ctx = new ExecuteContext(call);
    getBridge().executeOnMainThread(() -> {
        GenericAd ad = (GenericAd) ctx.optAdOrError();
        if (ad != null) {
            ad.hide(ctx);
        }
    });
}
Also used : GenericAd(admob.plus.core.GenericAd) PluginMethod(com.getcapacitor.PluginMethod)

Example 27 with PluginMethod

use of com.getcapacitor.PluginMethod in project admob-plus by admob-plus.

the class AdMobPlusPlugin method adLoad.

@PluginMethod
public void adLoad(PluginCall call) {
    final ExecuteContext ctx = new ExecuteContext(call);
    getBridge().executeOnMainThread(() -> {
        GenericAd ad = (GenericAd) ctx.optAdOrError();
        if (ad != null) {
            ad.load(ctx);
        }
    });
}
Also used : GenericAd(admob.plus.core.GenericAd) PluginMethod(com.getcapacitor.PluginMethod)

Example 28 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-music-controls-plugin-new by gokadzev.

the class CapacitorMusicControls method create.

@PluginMethod()
public void create(PluginCall call) {
    JSObject options = call.getData();
    this.initialize();
    this.updateMetadata(options);
    call.resolve();
}
Also used : JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 29 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-music-controls-plugin-new by gokadzev.

the class CapacitorMusicControls method updateDismissable.

@PluginMethod()
public void updateDismissable(PluginCall call) {
    JSObject params = call.getData();
    try {
        final boolean dismissable = params.getBoolean("dismissable");
        this.notification.updateDismissable(dismissable);
        call.resolve();
    } catch (JSONException e) {
        call.reject("error in updateDismissable");
    }
}
Also used : JSObject(com.getcapacitor.JSObject) JSONException(org.json.JSONException) PluginMethod(com.getcapacitor.PluginMethod)

Example 30 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-music-controls-plugin-new by gokadzev.

the class CapacitorMusicControls method destroy.

@PluginMethod()
public void destroy(PluginCall call) {
    final Activity activity = getActivity();
    final Context context = activity.getApplicationContext();
    this.destroyPlayerNotification();
    try {
        context.unregisterReceiver(this.mMessageReceiver);
        this.mediaSessionCompat.setActive(false);
        this.mediaSessionCompat.setMetadata(null);
        this.mediaSessionCompat.setPlaybackState(null);
        this.mMessageReceiver = null;
        this.notification = null;
        this.mediaSessionCompat = null;
        this.mediaButtonPendingIntent = null;
        this.mMediaSessionCallback = null;
    } catch (IllegalArgumentException e) {
    }
    this.unregisterMediaButtonEvent();
    call.resolve();
}
Also used : Context(android.content.Context) Activity(android.app.Activity) PluginMethod(com.getcapacitor.PluginMethod)

Aggregations

PluginMethod (com.getcapacitor.PluginMethod)120 JSObject (com.getcapacitor.JSObject)93 JSONException (org.json.JSONException)18 MyRunnable (com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable)13 JSONObject (org.json.JSONObject)13 JSArray (com.getcapacitor.JSArray)12 Radar (io.radar.sdk.Radar)11 Location (android.location.Location)8 Intent (android.content.Intent)7 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 Uri (android.net.Uri)5 LatLng (com.google.android.libraries.maps.model.LatLng)5 GenericAd (admob.plus.core.GenericAd)4 GoogleSignInAccount (com.google.android.gms.auth.api.signin.GoogleSignInAccount)4 Gson (com.google.gson.Gson)4 PackageManager (android.content.pm.PackageManager)3 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)3 User (io.ionic.demo.ecommerce.data.model.User)3 Context (android.content.Context)2