Search in sources :

Example 36 with JSObject

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

the class MediaSessionCallback method onSkipToNext.

@Override
public void onSkipToNext() {
    super.onSkipToNext();
    JSObject ret = new JSObject();
    ret.put("message", "music-controls-media-button-next");
    this.musicControls.controlsNotification(ret);
// if(this.cb != null) {
// this.cb.success("{\"message\": \"music-controls-media-button-next\"}");
// this.cb = null;
// }
}
Also used : JSObject(com.getcapacitor.JSObject)

Example 37 with JSObject

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

the class MusicControlsBroadcastReceiver method stopListening.

public void stopListening() {
    JSObject ret = new JSObject();
    ret.put("message", "music-controls-stop-listening");
    this.musicControls.controlsNotification(ret);
}
Also used : JSObject(com.getcapacitor.JSObject)

Example 38 with JSObject

use of com.getcapacitor.JSObject 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 39 with JSObject

use of com.getcapacitor.JSObject 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 40 with JSObject

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

the class CapacitorMusicControls method updateState.

@PluginMethod()
public void updateState(PluginCall call) {
    JSObject params = call.getData();
    try {
        final boolean isPlaying = params.getBoolean("isPlaying");
        final long elapsed = params.getLong("elapsed");
        this.notification.updateIsPlaying(isPlaying);
        if (isPlaying)
            this.setMediaPlaybackState(PlaybackStateCompat.STATE_PLAYING, elapsed);
        else
            this.setMediaPlaybackState(PlaybackStateCompat.STATE_PAUSED, elapsed);
        call.resolve();
    } catch (JSONException e) {
        call.reject("error in updateState");
    }
}
Also used : JSObject(com.getcapacitor.JSObject) JSONException(org.json.JSONException) PluginMethod(com.getcapacitor.PluginMethod)

Aggregations

JSObject (com.getcapacitor.JSObject)169 PluginMethod (com.getcapacitor.PluginMethod)93 JSONException (org.json.JSONException)28 JSONObject (org.json.JSONObject)20 MyRunnable (com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable)16 JSArray (com.getcapacitor.JSArray)14 Radar (io.radar.sdk.Radar)12 Uri (android.net.Uri)11 Location (android.location.Location)9 JSONArray (org.json.JSONArray)7 ArrayList (java.util.ArrayList)6 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 ParseException (java.text.ParseException)5 Intent (android.content.Intent)4 FirebaseUser (com.google.firebase.auth.FirebaseUser)4 Gson (com.google.gson.Gson)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4