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);
}
});
}
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);
}
});
}
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();
}
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");
}
}
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();
}
Aggregations