本文整理汇总了Java中org.apache.cordova.LOG.w方法的典型用法代码示例。如果您正苦于以下问题:Java LOG.w方法的具体用法?Java LOG.w怎么用?Java LOG.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cordova.LOG
的用法示例。
在下文中一共展示了LOG.w方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchSuccessStartActivity
import org.apache.cordova.LOG; //导入方法依赖的package包/类
/**
* Prepare the mTransaction object and execute transaction if SDK is ready
*/
private void launchSuccessStartActivity()
{
LOG.w("eliberty.cordova.plugin.payzen", "launchSuccessStartActivity");
MCurrency currency = MposSDK.getDefaultCurrencies();
if(currency!=null) {
MCustomer mposCustomer = new MCustomer();
mposCustomer.setEmail(email);
MTransaction mTransaction = new MTransaction();
mTransaction.setAmount(amount);
mTransaction.setCurrency(currency);
mTransaction.setOrderId(orderId);
mTransaction.setOperationType(MTransactionType.DEBIT);
mTransaction.setCustomer(mposCustomer);
mTransaction.setOrderInfo(label);
executeTransaction(mTransaction);
}else{
LOG.w("eliberty.cordova.plugin.payzen", "MposSDK.getDefaultCurrencies() is null");
raven.sendMessage("MposSDK.getDefaultCurrencies() is null");
runCallbackError(TOUCH_SDK_NOT_READY, "MposSDK.getDefaultCurrencies() is null");
}
}
示例2: runCallbackSuccess
import org.apache.cordova.LOG; //导入方法依赖的package包/类
/**
* Return a Json object for the cordova's callback in case of mpos success
* @param result The result of Transaction
*/
private void runCallbackSuccess(Result result)
{
try {
LOG.w("eliberty.cordova.plugin.payzen", "call success callback runCallbackSuccess");
JSONObject obj = new JSONObject();
obj.put("transactionId", result.getTransaction().getTransactionId());
obj.put("transactionUuId", result.getTransaction().getTransactionUuid());
obj.put("status", result.getTransaction().getTransactionStatusLabel().toString());
obj.put("receipt", result.getTransaction().getReceipt());
obj.put("transactionDate", result.getTransaction().getSubmissionDate());
callbackContext.success(obj);
}
catch (JSONException jse) {
raven.sendException(jse);
LOG.w("eliberty.cordova.plugin.payzen", "JSONException : " + jse.getMessage());
runCallbackError(Integer.toString(jse.hashCode()), jse.getMessage());
}
catch (Exception ex) {
LOG.w("eliberty.cordova.plugin.payzen", "Exception", ex);
raven.sendException(ex);
runCallbackError(Integer.toString(ex.hashCode()), ex.getMessage());
}
}
示例3: runCallbackError
import org.apache.cordova.LOG; //导入方法依赖的package包/类
/**
* Return a Json object for the cordova's callback in case of mpos error
*
* @param code The code error
* @param message The message error
*/
private void runCallbackError(String code, String message)
{
try {
LOG.w("eliberty.cordova.plugin.payzen", "call error callback runCallbackError");
JSONObject obj = new JSONObject();
obj.put("code", code);
obj.put("message", message);
synchronized(callbackContext){
callbackContext.error(obj);
callbackContext.notify();
}
}
catch (JSONException jse) {
raven.sendException(jse);
LOG.w("eliberty.cordova.plugin.payzen", "JSONException : " + jse.getMessage());
}
catch (Exception ex) {
LOG.w("eliberty.cordova.plugin.payzen", "Exception", ex);
raven.sendException(ex);
}
}
示例4: shouldInterceptRequest
import org.apache.cordova.LOG; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
try {
// Check the against the whitelist and lock out access to the WebView directory
// Changing this will cause problems for your application
if (!parentEngine.pluginManager.shouldAllowRequest(url)) {
LOG.w(TAG, "URL blocked by whitelist: " + url);
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}
CordovaResourceApi resourceApi = parentEngine.resourceApi;
Uri origUri = Uri.parse(url);
// Allow plugins to intercept WebView requests.
Uri remappedUri = resourceApi.remapUri(origUri);
if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) {
CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true);
return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream);
}
// If we don't need to special-case the request, let the browser load it.
return null;
} catch (IOException e) {
if (!(e instanceof FileNotFoundException)) {
LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e);
}
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}
}
示例5: shouldInterceptRequest
import org.apache.cordova.LOG; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
try {
// Check the against the whitelist and lock out access to the WebView directory
// Changing this will cause problems for your application
if (!parentEngine.pluginManager.shouldAllowRequest(url)) {
LOG.w(TAG, "URL blocked by whitelist: " + url);
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}
CordovaResourceApi resourceApi = parentEngine.resourceApi;
Uri origUri = Uri.parse(url);
// Allow plugins to intercept WebView requests.
Uri remappedUri = resourceApi.remapUri(origUri);
if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) {
CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true);
return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream);
}
// If we don't need to special-case the request, let the browser load it.
return null;
} catch (IOException e) {
if (!(e instanceof FileNotFoundException)) {
LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e);
}
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}
}
示例6: createFileTransferError
import org.apache.cordova.LOG; //导入方法依赖的package包/类
private static JSONObject createFileTransferError(int errorCode, String source, String target, URLConnection connection, Throwable throwable) {
int httpStatus = 0;
StringBuilder bodyBuilder = new StringBuilder();
String body = null;
if (connection != null) {
try {
if (connection instanceof HttpURLConnection) {
httpStatus = ((HttpURLConnection)connection).getResponseCode();
InputStream err = ((HttpURLConnection) connection).getErrorStream();
if(err != null)
{
BufferedReader reader = new BufferedReader(new InputStreamReader(err, "UTF-8"));
try {
String line = reader.readLine();
while(line != null) {
bodyBuilder.append(line);
line = reader.readLine();
if(line != null) {
bodyBuilder.append('\n');
}
}
body = bodyBuilder.toString();
} finally {
reader.close();
}
}
}
// IOException can leave connection object in a bad state, so catch all exceptions.
} catch (Throwable e) {
LOG.w(LOG_TAG, "Error getting HTTP status code from connection.", e);
}
}
return createFileTransferError(errorCode, source, target, body, httpStatus, throwable);
}
示例7: shouldInterceptRequest
import org.apache.cordova.LOG; //导入方法依赖的package包/类
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
try {
// Check the against the whitelist and lock out access to the WebView directory
// Changing this will cause problems for your application
if (isUrlHarmful(url)) {
LOG.w(TAG, "URL blocked by whitelist: " + url);
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}
CordovaResourceApi resourceApi = appView.getResourceApi();
Uri origUri = Uri.parse(url);
// Allow plugins to intercept WebView requests.
Uri remappedUri = resourceApi.remapUri(origUri);
if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) {
OpenForReadResult result = resourceApi.openForRead(remappedUri, true);
return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream);
}
// If we don't need to special-case the request, let the browser load it.
return null;
} catch (IOException e) {
if (!(e instanceof FileNotFoundException)) {
LOG.e("IceCreamCordovaWebViewClient", "Error occurred while loading a file (returning a 404).", e);
}
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}
}
示例8: registerNotifyCallback
import org.apache.cordova.LOG; //导入方法依赖的package包/类
private void registerNotifyCallback(CallbackContext callbackContext, UUID serviceUUID, UUID characteristicUUID) {
boolean success = false;
if (gatt == null) {
callbackContext.error("BluetoothGatt is null");
return;
}
BluetoothGattService service = gatt.getService(serviceUUID);
BluetoothGattCharacteristic characteristic = findNotifyCharacteristic(service, characteristicUUID);
String key = generateHashKey(serviceUUID, characteristic);
if (characteristic != null) {
notificationCallbacks.put(key, callbackContext);
if (gatt.setCharacteristicNotification(characteristic, true)) {
// Why doesn't setCharacteristicNotification write the descriptor?
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIGURATION_UUID);
if (descriptor != null) {
// prefer notify over indicate
if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_NOTIFY) != 0) {
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
} else if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_INDICATE) != 0) {
descriptor.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE);
} else {
LOG.w(TAG, "Characteristic " + characteristicUUID + " does not have NOTIFY or INDICATE property set");
}
if (gatt.writeDescriptor(descriptor)) {
success = true;
} else {
callbackContext.error("Failed to set client characteristic notification for " + characteristicUUID);
}
} else {
callbackContext.error("Set notification failed for " + characteristicUUID);
}
} else {
callbackContext.error("Failed to register notification for " + characteristicUUID);
}
} else {
callbackContext.error("Characteristic " + characteristicUUID + " not found");
}
if (!success) {
commandCompleted();
}
}