當前位置: 首頁>>代碼示例>>Java>>正文


Java LOG.e方法代碼示例

本文整理匯總了Java中org.apache.cordova.LOG.e方法的典型用法代碼示例。如果您正苦於以下問題:Java LOG.e方法的具體用法?Java LOG.e怎麽用?Java LOG.e使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.cordova.LOG的用法示例。


在下文中一共展示了LOG.e方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setAudioOutputDevice

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Set the audio device to be used for playback.
 *
 * @param output			1=earpiece, 2=speaker
 */
@SuppressWarnings("deprecation")
public void setAudioOutputDevice(int output) {
    String TAG1 = "AudioHandler.setAudioOutputDevice(): Error : ";

    AudioManager audiMgr = (AudioManager) this.cordova.getActivity().getSystemService(Context.AUDIO_SERVICE);
    if (output == 2) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
    }
    else if (output == 1) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
    }
    else {
         LOG.e(TAG1," Unknown output device");
    }
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:21,代碼來源:AudioHandler.java

示例2: deliverPermissionResult

import org.apache.cordova.LOG; //導入方法依賴的package包/類
private static void deliverPermissionResult(CordovaPlugin plugin, int requestCode, String[] permissions) {
    // Generate the request results
    int[] requestResults = new int[permissions.length];
    Arrays.fill(requestResults, PackageManager.PERMISSION_GRANTED);

    try {
        Method onRequestPermissionResult = CordovaPlugin.class.getDeclaredMethod(
                "onRequestPermissionResult", int.class, String[].class, int[].class);

        onRequestPermissionResult.invoke(plugin, requestCode, permissions, requestResults);
    } catch (NoSuchMethodException noSuchMethodException) {
        // Should never be caught since the plugin must be written for cordova-android 5.0.0+ if it
        // made it to this point
        LOG.e(LOG_TAG, "NoSuchMethodException when delivering permissions results", noSuchMethodException);
    } catch (IllegalAccessException illegalAccessException) {
        // Should never be caught; this is a public method
        LOG.e(LOG_TAG, "IllegalAccessException when delivering permissions results", illegalAccessException);
    } catch(InvocationTargetException invocationTargetException) {
        // This method may throw a JSONException. We are just duplicating cordova-android's
        // exception handling behavior here; all it does is log the exception in CordovaActivity,
        // print the stacktrace, and ignore it
        LOG.e(LOG_TAG, "InvocationTargetException when delivering permissions results", invocationTargetException);
    }
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:25,代碼來源:PermissionHelper.java

示例3: requestPermissions

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Requests "dangerous" permissions for the application at runtime. This is a helper method
 * alternative to cordovaInterface.requestPermissions() that does not require the project to be
 * built with cordova-android 5.0.0+
 *
 * @param plugin        The plugin the permissions are being requested for
 * @param requestCode   A requestCode to be passed to the plugin's onRequestPermissionResult()
 *                      along with the result of the permissions request
 * @param permissions   The permissions to be requested
 */
public static void requestPermissions(CordovaPlugin plugin, int requestCode, String[] permissions) {
    try {
        Method requestPermission = CordovaInterface.class.getDeclaredMethod(
                "requestPermissions", CordovaPlugin.class, int.class, String[].class);

        // If there is no exception, then this is cordova-android 5.0.0+
        requestPermission.invoke(plugin.cordova, plugin, requestCode, permissions);
    } catch (NoSuchMethodException noSuchMethodException) {
        // cordova-android version is less than 5.0.0, so permission is implicitly granted
        LOG.d(LOG_TAG, "No need to request permissions " + Arrays.toString(permissions));

        // Notify the plugin that all were granted by using more reflection
        deliverPermissionResult(plugin, requestCode, permissions);
    } catch (IllegalAccessException illegalAccessException) {
        // Should never be caught; this is a public method
        LOG.e(LOG_TAG, "IllegalAccessException when requesting permissions " + Arrays.toString(permissions), illegalAccessException);
    } catch(InvocationTargetException invocationTargetException) {
        // This method does not throw any exceptions, so this should never be caught
        LOG.e(LOG_TAG, "invocationTargetException when requesting permissions " + Arrays.toString(permissions), invocationTargetException);
    }
}
 
開發者ID:alex-shpak,項目名稱:keemob,代碼行數:32,代碼來源:PermissionHelper.java

示例4: getRealPath

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Returns the real path of the given URI string.
 * If the given URI string represents a content:// URI, the real path is retrieved from the media store.
 *
 * @param uriString the URI string of the audio/image/video
 * @param cordova the current application context
 * @return the full path to the file
 */
@SuppressWarnings("deprecation")
public static String getRealPath(String uriString, CordovaInterface cordova) {
    String realPath = null;

    if (uriString.startsWith("content://")) {
        String[] proj = { _DATA };
        Cursor cursor = cordova.getActivity().managedQuery(Uri.parse(uriString), proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(_DATA);
        cursor.moveToFirst();
        realPath = cursor.getString(column_index);
        if (realPath == null) {
            LOG.e(LOG_TAG, "Could get real path for URI string %s", uriString);
        }
    } else if (uriString.startsWith("file://")) {
        realPath = uriString.substring(7);
        if (realPath.startsWith("/android_asset/")) {
            LOG.e(LOG_TAG, "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", uriString);
            realPath = null;
        }
    } else {
        realPath = uriString;
    }

    return realPath;
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:34,代碼來源:FileHelper.java

示例5: onMediaScannerConnected

import org.apache.cordova.LOG; //導入方法依賴的package包/類
public void onMediaScannerConnected() {
    try {
        this.conn.scanFile(this.scanMe.toString(), "image/*");
    } catch (java.lang.IllegalStateException e) {
        LOG.e(LOG_TAG, "Can't scan file in MediaScanner after taking picture");
    }

}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:9,代碼來源:CameraLauncher.java

示例6: onActivityResult

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Called when user picks contact.
 * @param requestCode       The request code originally supplied to startActivityForResult(),
 *                          allowing you to identify who this result came from.
 * @param resultCode        The integer result code returned by the child activity through its setResult().
 * @param intent            An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
 * @throws JSONException
 */
public void onActivityResult(int requestCode, int resultCode, final Intent intent) {
    if (requestCode == CONTACT_PICKER_RESULT) {
        if (resultCode == Activity.RESULT_OK) {
            String contactId = intent.getData().getLastPathSegment();
            // to populate contact data we require  Raw Contact ID
            // so we do look up for contact raw id first
            Cursor c =  this.cordova.getActivity().getContentResolver().query(RawContacts.CONTENT_URI,
                        new String[] {RawContacts._ID}, RawContacts.CONTACT_ID + " = " + contactId, null, null);
            if (!c.moveToFirst()) {
                this.callbackContext.error("Error occured while retrieving contact raw id");
                return;
            }
            String id = c.getString(c.getColumnIndex(RawContacts._ID));
            c.close();

            try {
                JSONObject contact = contactAccessor.getContactById(id);
                this.callbackContext.success(contact);
                return;
            } catch (JSONException e) {
                LOG.e(LOG_TAG, "JSON fail.", e);
            }
        } else if (resultCode == Activity.RESULT_CANCELED) {
            callbackContext.error(OPERATION_CANCELLED_ERROR);
            return;
        }

        this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, UNKNOWN_ERROR));
    }
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:39,代碼來源:ContactManager.java

示例7: 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);
    }
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:32,代碼來源:SystemWebViewClient.java

示例8: parse

import org.apache.cordova.LOG; //導入方法依賴的package包/類
public void parse(Activity action) {
    // First checking the class namespace for config.xml
    int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName());
    if (id == 0) {
        // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
        id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
        if (id == 0) {
            LOG.e(TAG, "res/xml/config.xml is missing!");
            return;
        }
    }
    parse(action.getResources().getXml(id));
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:14,代碼來源:ConfigXmlParser.java

示例9: destroy

import org.apache.cordova.LOG; //導入方法依賴的package包/類
@Override
public void destroy() {
    webView.chromeClient.destroyLastDialog();
    webView.destroy();
    // unregister the receiver
    if (receiver != null) {
        try {
            webView.getContext().unregisterReceiver(receiver);
        } catch (Exception e) {
            LOG.e(TAG, "Error unregistering configuration receiver: " + e.getMessage(), e);
        }
    }
}
 
開發者ID:fachrihawari,項目名稱:cordova-vuetify,代碼行數:14,代碼來源:SystemWebViewEngine.java

示例10: onDestroy

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Stop network receiver.
 */
public void onDestroy() {
    if (this.receiver != null) {
        try {
            webView.getContext().unregisterReceiver(this.receiver);
        } catch (Exception e) {
            LOG.e(LOG_TAG, "Error unregistering network receiver: " + e.getMessage(), e);
        } finally {
            receiver = null;
        }
    }
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:15,代碼來源:NetworkManager.java

示例11: removeStateListener

import org.apache.cordova.LOG; //導入方法依賴的package包/類
private void removeStateListener() {
    if (this.stateReceiver != null) {
        try {
            webView.getContext().unregisterReceiver(this.stateReceiver);
        } catch (Exception e) {
            LOG.e(TAG, "Error unregistering state receiver: " + e.getMessage(), e);
        }
    }
    this.stateCallback = null;
    this.stateReceiver = null;
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:12,代碼來源:BLECentralPlugin.java

示例12: onServicesDiscovered

import org.apache.cordova.LOG; //導入方法依賴的package包/類
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
    super.onServicesDiscovered(gatt, status);

    if (status == BluetoothGatt.GATT_SUCCESS) {
        PluginResult result = new PluginResult(PluginResult.Status.OK, this.asJSONObject(gatt));
        result.setKeepCallback(true);
        connectCallback.sendPluginResult(result);
    } else {
        LOG.e(TAG, "Service discovery failed. status = " + status);
        connectCallback.error(this.asJSONObject("Service discovery failed"));
        disconnect();
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:15,代碼來源:Peripheral.java

示例13: 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);
    }
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:31,代碼來源:IceCreamCordovaWebViewClient.java

示例14: populateContact

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Create a new contact using a JSONObject to hold all the data.
 * @param contact
 * @param organizations array of organizations
 * @param addresses array of addresses
 * @param phones array of phones
 * @param emails array of emails
 * @param ims array of instant messenger addresses
 * @param websites array of websites
 * @param photos
 * @return
 */
private JSONObject populateContact(JSONObject contact, JSONArray organizations,
        JSONArray addresses, JSONArray phones, JSONArray emails,
        JSONArray ims, JSONArray websites, JSONArray photos) {
    try {
        // Only return the array if it has at least one entry
        if (organizations.length() > 0) {
            contact.put("organizations", organizations);
        }
        if (addresses.length() > 0) {
            contact.put("addresses", addresses);
        }
        if (phones.length() > 0) {
            contact.put("phoneNumbers", phones);
        }
        if (emails.length() > 0) {
            contact.put("emails", emails);
        }
        if (ims.length() > 0) {
            contact.put("ims", ims);
        }
        if (websites.length() > 0) {
            contact.put("urls", websites);
        }
        if (photos.length() > 0) {
            contact.put("photos", photos);
        }
    } catch (JSONException e) {
        LOG.e(LOG_TAG, e.getMessage(), e);
    }
    return contact;
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:44,代碼來源:ContactAccessorSdk5.java

示例15: buildPopulationSet

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Create a hash map of what data needs to be populated in the Contact object
 * @param fields the list of fields to populate
 * @return the hash map of required data
 */
protected HashMap<String, Boolean> buildPopulationSet(JSONObject options) {
    HashMap<String, Boolean> map = new HashMap<String, Boolean>();

    String key;
    try {
        JSONArray desiredFields = null;
        if (options!=null && options.has("desiredFields")) {
            desiredFields = options.getJSONArray("desiredFields");
        }
        if (desiredFields == null || desiredFields.length() == 0) {
            map.put("displayName", true);
            map.put("name", true);
            map.put("nickname", true);
            map.put("phoneNumbers", true);
            map.put("emails", true);
            map.put("addresses", true);
            map.put("ims", true);
            map.put("organizations", true);
            map.put("birthday", true);
            map.put("note", true);
            map.put("urls", true);
            map.put("photos", true);
            map.put("categories", true);
        } else {
            for (int i = 0; i < desiredFields.length(); i++) {
                key = desiredFields.getString(i);
                if (key.startsWith("displayName")) {
                    map.put("displayName", true);
                } else if (key.startsWith("name")) {
                    map.put("displayName", true);
                    map.put("name", true);
                } else if (key.startsWith("nickname")) {
                    map.put("nickname", true);
                } else if (key.startsWith("phoneNumbers")) {
                    map.put("phoneNumbers", true);
                } else if (key.startsWith("emails")) {
                    map.put("emails", true);
                } else if (key.startsWith("addresses")) {
                    map.put("addresses", true);
                } else if (key.startsWith("ims")) {
                    map.put("ims", true);
                } else if (key.startsWith("organizations")) {
                    map.put("organizations", true);
                } else if (key.startsWith("birthday")) {
                    map.put("birthday", true);
                } else if (key.startsWith("note")) {
                    map.put("note", true);
                } else if (key.startsWith("urls")) {
                    map.put("urls", true);
                } else if (key.startsWith("photos")) {
                    map.put("photos", true);
                } else if (key.startsWith("categories")) {
                    map.put("categories", true);
                }
            }
        }
    } catch (JSONException e) {
        LOG.e(LOG_TAG, e.getMessage(), e);
    }
    return map;
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:67,代碼來源:ContactAccessor.java


注:本文中的org.apache.cordova.LOG.e方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。