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