当前位置: 首页>>代码示例>>Java>>正文


Java CordovaArgs类代码示例

本文整理汇总了Java中org.apache.cordova.CordovaArgs的典型用法代码示例。如果您正苦于以下问题:Java CordovaArgs类的具体用法?Java CordovaArgs怎么用?Java CordovaArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CordovaArgs类属于org.apache.cordova包,在下文中一共展示了CordovaArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clear

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private void clear(final CordovaArgs args, final CallbackContext callbackContext) {
    cordova.getThreadPool().execute(new Runnable() {
        @Override
        public void run() {
            try {
                String namespace = args.getString(0);
                JSONObject oldValues = getStorage(namespace);
                setStorage(namespace, new JSONObject());
                callbackContext.success(oldValues);
            } catch (Exception e) {
                Log.e(LOG_TAG, "Could not clear storage", e);
                callbackContext.error("Could not update storage");
            }
        }
    });
}
 
开发者ID:ZachMoreno,项目名称:krakn,代码行数:17,代码来源:ChromeStorage.java

示例2: execute

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
    if (!action.equals("navigation")) {
        return false;
    }

    this.option = NavigationOption.parseArgs(args);
    this.callbackContext = callbackContext;

    if (!hasPermisssion()) {
        PermissionHelper.requestPermissions(this, 0, permissions);
    } else {
        this.showNavigationView();
    }

    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
    pluginResult.setKeepCallback(true);
    callbackContext.sendPluginResult(pluginResult);
    return true;
}
 
开发者ID:luocongqiu,项目名称:cordova-plugin-navigation,代码行数:20,代码来源:NavigationPlugin.java

示例3: execute

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
@Override
public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
    boolean cmdProcessed = true;
    if (JSAction.INIT.equals(action)) {
        jsInit(callbackContext);
    } else if (JSAction.FETCH_UPDATE.equals(action)) {
        jsFetchUpdate(callbackContext, args);
    } else if (JSAction.INSTALL_UPDATE.equals(action)) {
        jsInstallUpdate(callbackContext);
    } else if (JSAction.CONFIGURE.equals(action)) {
        jsSetPluginOptions(args, callbackContext);
    } else if (JSAction.REQUEST_APP_UPDATE.equals(action)) {
        jsRequestAppUpdate(args, callbackContext);
    } else if (JSAction.IS_UPDATE_AVAILABLE_FOR_INSTALLATION.equals(action)) {
        jsIsUpdateAvailableForInstallation(callbackContext);
    } else if (JSAction.GET_VERSION_INFO.equals(action)) {
        jsGetVersionInfo(callbackContext);
    } else {
        cmdProcessed = false;
    }

    return cmdProcessed;
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:24,代码来源:HotCodePushPlugin.java

示例4: jsFetchUpdate

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
/**
 * Check for update.
 * Method is called from JS side.
 *
 * @param callback js callback
 */
private void jsFetchUpdate(CallbackContext callback, CordovaArgs args) {
    if (!isPluginReadyForWork) {
        sendPluginNotReadyToWork(UpdateDownloadErrorEvent.EVENT_NAME, callback);
        return;
    }

    FetchUpdateOptions fetchOptions = null;
    try {
        fetchOptions = new FetchUpdateOptions(args.optJSONObject(0));
    } catch (JSONException ignored) {
    }

    fetchUpdate(callback, fetchOptions);
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:21,代码来源:HotCodePushPlugin.java

示例5: jsSetPluginOptions

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
/**
 * Set plugin options. Method is called from JavaScript.
 *
 * @param arguments arguments from JavaScript
 * @param callback  callback where to send result
 */
@Deprecated
private void jsSetPluginOptions(CordovaArgs arguments, CallbackContext callback) {
    if (!isPluginReadyForWork) {
        sendPluginNotReadyToWork("", callback);
        return;
    }

    try {
        JSONObject jsonObject = (JSONObject) arguments.get(0);
        chcpXmlConfig.mergeOptionsFromJs(jsonObject);
        // TODO: store them somewhere?
    } catch (JSONException e) {
        Log.d("CHCP", "Failed to process plugin options, received from JS.", e);
    }

    callback.success();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:24,代码来源:HotCodePushPlugin.java

示例6: jsRequestAppUpdate

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
/**
 * Show dialog with request to update the application through the Google Play.
 *
 * @param arguments arguments from JavaScript
 * @param callback  callback where to send result
 */
private void jsRequestAppUpdate(final CordovaArgs arguments, final CallbackContext callback) {
    if (!isPluginReadyForWork) {
        sendPluginNotReadyToWork("", callback);
        return;
    }

    String msg = null;
    try {
        msg = (String) arguments.get(0);
    } catch (JSONException e) {
        Log.d("CHCP", "Dialog message is not set", e);
    }

    if (TextUtils.isEmpty(msg)) {
        return;
    }

    final String storeURL = appConfigStorage.loadFromFolder(fileStructure.getWwwFolder()).getStoreUrl();

    new AppUpdateRequestDialog(cordova.getActivity(), msg, storeURL, callback).show();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:28,代码来源:HotCodePushPlugin.java

示例7: execute

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
@Override
public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
    if ("messageChannel".equals(action)) {
        messageChannel = callbackContext;
        sendEventMessage("startup", BackgroundActivity.topInstance != null);
        return true;
    } else if ("show".equals(action)) {
        cordova.getThreadPool().execute(new Runnable() {
            @Override
            public void run() {
                show(callbackContext);
            }
        });
        return true;
    }
    return false;
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-background-app,代码行数:18,代码来源:BackgroundPlugin.java

示例8: listenUsingRfcomm

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private void listenUsingRfcomm(CordovaArgs args, final CallbackContext callbackContext)
    throws JSONException {

  int socketId = args.getInt(0);
  String uuid = args.getString(1);
  JSONObject options = args.getJSONObject(2);

  ChromeBluetoothSocketSocket socket = sockets.get(socketId);

  if (socket == null) {
    callbackContext.error("Invalid Argument");
    return;
  }

  socket.listenUsingRfcomm(uuid, options, callbackContext);
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-chrome-apps-bluetoothSocket,代码行数:17,代码来源:ChromeBluetoothSocket.java

示例9: execRestartApplication

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private boolean execRestartApplication(CordovaArgs args, CallbackContext callbackContext) {
    try {
        /* check if we have a deployed package already */
        CodePushPackageMetadata deployedPackageMetadata = this.codePushPackageManager.getCurrentPackageMetadata();
        if (deployedPackageMetadata != null) {
            callbackContext.success();
            didStartApp = false;
            onStart();
        } else {
            final String configLaunchUrl = this.getConfigLaunchUrl();
            if (!this.pluginDestroyed) {
                callbackContext.success();
                this.cordova.getActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        navigateToURL(configLaunchUrl);
                    }
                });
            }
        }
    } catch (Exception e) {
        callbackContext.error("An error occurred while restarting the application." + e.getMessage());
    }
    return true;
}
 
开发者ID:Thinkmill,项目名称:reacteu-app,代码行数:26,代码来源:CodePush.java

示例10: connect

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private void connect(CordovaArgs args, boolean secure, CallbackContext callbackContext) throws JSONException {
    String macAddress = args.getString(0);
    BluetoothDevice device = bluetoothAdapter.getRemoteDevice(macAddress);

    if (device != null) {
        connectCallback = callbackContext;
        bluetoothSerialService.connect(device, secure);

        PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
        result.setKeepCallback(true);
        callbackContext.sendPluginResult(result);

    } else {
        callbackContext.error("Could not connect to " + macAddress);
    }
}
 
开发者ID:GinoLlerena,项目名称:DemoArduinoAndroidCordovaBT,代码行数:17,代码来源:BluetoothSerial.java

示例11: consume

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
public void consume(CordovaArgs args, final CallbackContext ctx) {
	String productId = args.optString(0);
	if (productId == null) {
		ctx.sendPluginResult(new PluginResult(Status.ERROR, "Invalid argument"));
		return;
	}
	int quantity = args.optInt(1);
	if (quantity < 1) {
		quantity = 1;
	}
	service.consume(productId, quantity, new InAppService.ConsumeCallback() {
		@Override
		public void onComplete(int consumed, Error error) {
			if (error != null) {
				ctx.sendPluginResult(new PluginResult(Status.ERROR, errorToJSON(error)));
			}
			else {
				ctx.sendPluginResult(new PluginResult(Status.OK, consumed));
			}
		}
	});			
}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:23,代码来源:InAppServicePlugin.java

示例12: setPaused

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private void setPaused(CordovaArgs args, final CallbackContext callbackContext)
    throws JSONException {

  int socketId = args.getInt(0);
  boolean paused = args.getBoolean(1);

  ChromeBluetoothSocketSocket socket = sockets.get(socketId);

  if (socket == null) {
    callbackContext.error("Invalid Argument");
    return;
  }

  socket.setPaused(paused);
  callbackContext.success();
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-chrome-apps-bluetoothSocket,代码行数:17,代码来源:ChromeBluetoothSocket.java

示例13: setValidationHandler

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
public void setValidationHandler(CordovaArgs args, final CallbackContext ctx) {
	boolean noValidation = args.optBoolean(0);
	if (noValidation) {
		service.setValidationHandler(null);
		return;
	}
	service.setValidationHandler(new InAppService.ValidationHandler() {
		
		@Override
		public void onValidate(String receipt, String productId, ValidationCompletion completion) {
			
			int completionId = validationIndex++;
			validationCompletions.put(completionId, completion);
			JSONArray array = new JSONArray();
			array.put(receipt);
			array.put(productId);
			array.put(completionId);
			PluginResult result = new PluginResult(Status.OK, array);		
			result.setKeepCallback(true);
			ctx.sendPluginResult(result);
		}
	});
}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:24,代码来源:InAppServicePlugin.java

示例14: writeCharacteristicValue

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private void writeCharacteristicValue(CordovaArgs args, final CallbackContext callbackContext)
    throws JSONException {

  final String characteristicId = args.getString(0);
  String deviceAddress = getDeviceAddressFromInstanceId(characteristicId);
  final byte[] value = args.getArrayBuffer(1);

  final ChromeBluetoothLowEnergyPeripheral peripheral = getPeripheralByDeviceAddress(deviceAddress);

  if (peripheral == null) {
    callbackContext.error("Invalid Argument");
    return;
  }

  cordova.getThreadPool().execute(new Runnable() {
      public void run() {
        peripheral.writeCharacteristicValue(characteristicId, value, callbackContext);
      }
    });
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-chrome-apps-bluetoothLowEnergy,代码行数:21,代码来源:ChromeBluetoothLowEnergy.java

示例15: stopCharacteristicNotifications

import org.apache.cordova.CordovaArgs; //导入依赖的package包/类
private void stopCharacteristicNotifications(CordovaArgs args, final CallbackContext callbackContext)
    throws JSONException {

  final String characteristicId = args.getString(0);
  String deviceAddress = getDeviceAddressFromInstanceId(characteristicId);

  final ChromeBluetoothLowEnergyPeripheral peripheral = getPeripheralByDeviceAddress(deviceAddress);

  if (peripheral == null) {
    callbackContext.error("Invalid Argument");
    return;
  }

  cordova.getThreadPool().execute(new Runnable() {
      public void run() {
        peripheral.setCharacteristicNotification(characteristicId, false, callbackContext);
      }
    });
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-chrome-apps-bluetoothLowEnergy,代码行数:20,代码来源:ChromeBluetoothLowEnergy.java


注:本文中的org.apache.cordova.CordovaArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。