Search in sources :

Example 36 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.

the class LocalNotificationsPlugin method schedule.

/**
 * Schedule a notification call from JavaScript
 * Creates local notification in system.
 */
@PluginMethod
public void schedule(PluginCall call) {
    List<LocalNotification> localNotifications = LocalNotification.buildNotificationList(call);
    if (localNotifications == null) {
        return;
    }
    JSONArray ids = manager.schedule(call, localNotifications);
    if (ids != null) {
        notificationStorage.appendNotifications(localNotifications);
        JSObject result = new JSObject();
        JSArray jsArray = new JSArray();
        for (int i = 0; i < ids.length(); i++) {
            try {
                JSObject notification = new JSObject().put("id", ids.getInt(i));
                jsArray.put(notification);
            } catch (Exception ex) {
            }
        }
        result.put("notifications", jsArray);
        call.resolve(result);
    }
}
Also used : JSONArray(org.json.JSONArray) JSArray(com.getcapacitor.JSArray) JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 37 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.

the class LocalNotificationsPlugin method getPending.

@PluginMethod
public void getPending(PluginCall call) {
    List<LocalNotification> notifications = notificationStorage.getSavedNotifications();
    JSObject result = LocalNotification.buildLocalNotificationPendingList(notifications);
    call.resolve(result);
}
Also used : JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 38 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.

the class LocalNotificationsPlugin method areEnabled.

@PluginMethod
public void areEnabled(PluginCall call) {
    JSObject data = new JSObject();
    data.put("value", manager.areNotificationsEnabled());
    call.resolve(data);
}
Also used : JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 39 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.

the class LocalNotificationsPlugin method checkPermissions.

@PluginMethod
public void checkPermissions(PluginCall call) {
    JSObject permissionsResultJSON = new JSObject();
    permissionsResultJSON.put("display", getNotificationPermissionText());
    call.resolve(permissionsResultJSON);
}
Also used : JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 40 with PluginMethod

use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.

the class SharePlugin method canShare.

@PluginMethod
public void canShare(PluginCall call) {
    JSObject callResult = new JSObject();
    callResult.put("value", true);
    call.resolve(callResult);
}
Also used : JSObject(com.getcapacitor.JSObject) 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