use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class PushNotificationsPlugin method register.
@PluginMethod
public void register(PluginCall call) {
FirebaseMessaging.getInstance().setAutoInitEnabled(true);
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(getActivity(), new OnSuccessListener<InstanceIdResult>() {
@Override
public void onSuccess(InstanceIdResult instanceIdResult) {
sendToken(instanceIdResult.getToken());
}
});
FirebaseInstanceId.getInstance().getInstanceId().addOnFailureListener(new OnFailureListener() {
public void onFailure(Exception e) {
sendError(e.getLocalizedMessage());
}
});
call.resolve();
}
use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class DialogPlugin method confirm.
@PluginMethod
public void confirm(final PluginCall call) {
final AppCompatActivity activity = this.getActivity();
final String title = call.getString("title");
final String message = call.getString("message");
final String okButtonTitle = call.getString("okButtonTitle", "OK");
final String cancelButtonTitle = call.getString("cancelButtonTitle", "Cancel");
if (title == null || message == null) {
call.reject("Please provide a title or message for the alert");
return;
}
if (activity.isFinishing()) {
call.reject("App is finishing");
return;
}
Dialog.confirm(activity, message, title, okButtonTitle, cancelButtonTitle, (value, didCancel, inputValue) -> {
JSObject ret = new JSObject();
ret.put("value", value);
call.resolve(ret);
});
}
use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class ScreenReaderPlugin method isEnabled.
@SuppressWarnings("unused")
@PluginMethod
public void isEnabled(PluginCall call) {
JSObject ret = new JSObject();
ret.put("value", screenReader.isEnabled());
call.resolve(ret);
}
use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class TextZoomPlugin method get.
@PluginMethod
public void get(final PluginCall call) {
mainHandler.post(() -> {
JSObject ret = new JSObject();
ret.put("value", textZoom.get());
call.resolve(ret);
});
}
use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class StatusBarPlugin method getInfo.
@PluginMethod
public void getInfo(final PluginCall call) {
StatusBarInfo info = implementation.getInfo();
JSObject data = new JSObject();
data.put("visible", info.isVisible());
data.put("style", info.getStyle());
data.put("color", info.getColor());
data.put("overlays", info.isOverlays());
call.resolve(data);
}
Aggregations