use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class DevicePlugin method getInfo.
@PluginMethod
public void getInfo(PluginCall call) {
JSObject r = new JSObject();
r.put("memUsed", implementation.getMemUsed());
r.put("diskFree", implementation.getDiskFree());
r.put("diskTotal", implementation.getDiskTotal());
r.put("realDiskFree", implementation.getRealDiskFree());
r.put("realDiskTotal", implementation.getRealDiskTotal());
r.put("model", android.os.Build.MODEL);
r.put("operatingSystem", "android");
r.put("osVersion", android.os.Build.VERSION.RELEASE);
r.put("platform", implementation.getPlatform());
r.put("manufacturer", android.os.Build.MANUFACTURER);
r.put("isVirtual", implementation.isVirtual());
r.put("name", implementation.getName());
r.put("webViewVersion", implementation.getWebViewVersion());
call.resolve(r);
}
use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class AppPlugin method getState.
@PluginMethod
public void getState(PluginCall call) {
JSObject data = new JSObject();
data.put("isActive", this.bridge.getApp().isActive());
call.resolve(data);
}
use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class AppPlugin method getLaunchUrl.
@PluginMethod
public void getLaunchUrl(PluginCall call) {
Uri launchUri = bridge.getIntentUri();
if (launchUri != null) {
JSObject d = new JSObject();
d.put("url", launchUri.toString());
call.resolve(d);
} else {
call.resolve();
}
}
use of com.getcapacitor.PluginMethod in project capacitor-radar by radarlabs.
the class RadarPlugin method trackOnce.
@PluginMethod()
public void trackOnce(final PluginCall call) {
Radar.RadarTrackCallback callback = new Radar.RadarTrackCallback() {
@Override
public void onComplete(@NotNull Radar.RadarStatus status, @Nullable Location location, @Nullable RadarEvent[] events, @Nullable RadarUser user) {
if (status == Radar.RadarStatus.SUCCESS && location != null && events != null && user != null) {
JSObject ret = new JSObject();
ret.put("status", status.toString());
ret.put("location", RadarPlugin.jsObjectForJSONObject(Radar.jsonForLocation(location)));
ret.put("events", RadarPlugin.jsArrayForJSONArray(RadarEvent.toJson(events)));
ret.put("user", RadarPlugin.jsObjectForJSONObject(user.toJson()));
call.resolve(ret);
} else {
call.reject(status.toString());
}
}
};
if (call.hasOption("latitude") && call.hasOption("longitude") && call.hasOption("accuracy")) {
double latitude = call.getDouble("latitude");
double longitude = call.getDouble("longitude");
float accuracy = call.getDouble("accuracy").floatValue();
Location location = new Location("RadarSDK");
location.setLatitude(latitude);
location.setLongitude(longitude);
location.setAccuracy(accuracy);
Radar.trackOnce(location, callback);
} else {
Radar.trackOnce(callback);
}
}
use of com.getcapacitor.PluginMethod in project capacitor-radar by radarlabs.
the class RadarPlugin method setMetadata.
@PluginMethod()
public void setMetadata(PluginCall call) {
JSObject metadata = call.getObject("metadata");
Radar.setMetadata(RadarPlugin.jsonObjectForJSObject(metadata));
call.resolve();
}
Aggregations