List of usage examples for org.apache.cordova PluginResult PluginResult
public PluginResult(Status status, List<PluginResult> multipartMessages)
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void requestStateForRegion(final JSONObject arguments, CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override/* w w w .j a v a 2 s .c o m*/ public PluginResult run() { //not supported on Android PluginResult result = new PluginResult(PluginResult.Status.ERROR, "Manual request for monitoring update is not supported on Android"); result.setKeepCallback(true); return result; } }); }
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void isRangingAvailable(CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override//from w w w. j a va 2 s . c o m public PluginResult run() { try { //Check the Bluetooth service is running boolean available = iBeaconManager.checkAvailability(); return new PluginResult(PluginResult.Status.OK, available); } catch (BleNotAvailableException e) { //if device does not support iBeacons and error is thrown debugLog("'isRangingAvailable' Device not supported: " + e.getMessage()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } catch (Exception e) { debugWarn("'isRangingAvailable' exception " + e.getMessage()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } } }); }
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void isMonitoringAvailableForClass(final JSONObject arguments, final CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override// ww w . j a v a 2 s . co m public PluginResult run() { boolean isValid = true; try { parseRegion(arguments); } catch (Exception e) { //will fail is the region is circular or some expected structure is missing isValid = false; } PluginResult result = new PluginResult(PluginResult.Status.OK, isValid); result.setKeepCallback(true); return result; } }); }
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void isAdvertisingAvailable(CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override/*from w ww. java 2 s . com*/ public PluginResult run() { //not supported at Android yet (see Android L) PluginResult result = new PluginResult(PluginResult.Status.OK, false); result.setKeepCallback(true); return result; } }); }
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void isAdvertising(CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override/*w w w . j a v a 2s .c o m*/ public PluginResult run() { //not supported on Android PluginResult result = new PluginResult(PluginResult.Status.OK, false); result.setKeepCallback(true); return result; } }); }
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void startAdvertising(JSONObject arguments, CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override/* w w w .ja v a2s .c o m*/ public PluginResult run() { //not supported on Android PluginResult result = new PluginResult(PluginResult.Status.ERROR, "iBeacon Advertising is not supported on Android"); result.setKeepCallback(true); return result; } }); }
From source file:com.commontime.plugin.LocationManager.java
License:Apache License
private void stopAdvertising(CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override//from w ww .ja v a2s . com public PluginResult run() { //not supported on Android PluginResult result = new PluginResult(PluginResult.Status.ERROR, "iBeacon Advertising is not supported on Android"); result.setKeepCallback(true); return result; } }); }
From source file:com.commontime.plugin.notification.Notification.java
License:Open Source License
/** * If a notification with an ID is present. * * @param id NotificationWrapper ID * @param command The callback context used when calling back into JavaScript. *//* w w w. j a va2 s. c o m*/ private void isPresent(int id, CallbackContext command) { boolean exist = getNotificationMgr().exist(id); PluginResult result = new PluginResult(PluginResult.Status.OK, exist); command.sendPluginResult(result); }
From source file:com.commontime.plugin.notification.Notification.java
License:Open Source License
/** * If a notification with an ID is scheduled. * * @param id NotificationWrapper ID * @param command The callback context used when calling back into JavaScript. *//*from ww w. j a v a 2s . c o m*/ private void isScheduled(int id, CallbackContext command) { boolean exist = getNotificationMgr().exist(id, NotificationWrapper.Type.SCHEDULED); PluginResult result = new PluginResult(PluginResult.Status.OK, exist); command.sendPluginResult(result); }
From source file:com.commontime.plugin.notification.Notification.java
License:Open Source License
/** * If a notification with an ID is triggered. * * @param id NotificationWrapper ID * @param command The callback context used when calling back into JavaScript. *//*from w w w .j a va 2 s . c om*/ private void isTriggered(int id, CallbackContext command) { boolean exist = getNotificationMgr().exist(id, NotificationWrapper.Type.TRIGGERED); PluginResult result = new PluginResult(PluginResult.Status.OK, exist); command.sendPluginResult(result); }