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


Java LOG.d方法代碼示例

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


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

示例1: getUriFromMediaStore

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Create entry in media store for image
 *
 * @return uri
 */
private Uri getUriFromMediaStore() {
    ContentValues values = new ContentValues();
    values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
    Uri uri;
    try {
        uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    } catch (RuntimeException e) {
        LOG.d(LOG_TAG, "Can't write to external media storage.");
        try {
            uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
        } catch (RuntimeException ex) {
            LOG.d(LOG_TAG, "Can't write to internal media storage.");
            return null;
        }
    }
    return uri;
}
 
開發者ID:Andy-Ta,項目名稱:COB,代碼行數:23,代碼來源:CameraLauncher.java

示例2: remove

import org.apache.cordova.LOG; //導入方法依賴的package包/類
@Override
/**
 * This method will remove a Contact from the database based on ID.
 * @param id the unique ID of the contact to remove
 */
public boolean remove(String id) {
    int result = 0;
    Cursor cursor = mApp.getActivity().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
            null,
            ContactsContract.Contacts._ID + " = ?",
            new String[] { id }, null);

    if (cursor.getCount() == 1) {
        cursor.moveToFirst();
        String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
        Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey);
        result = mApp.getActivity().getContentResolver().delete(uri, null, null);
    } else {
        LOG.d(LOG_TAG, "Could not find contact with ID");
    }

    return (result > 0) ? true : false;
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:24,代碼來源:ContactAccessorSdk5.java

示例3: onExceededDatabaseQuota

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Handle database quota exceeded notification.
 *
 * @param url
 * @param databaseIdentifier
 * @param currentQuota
 * @param estimatedSize
 * @param totalUsedQuota
 * @param quotaUpdater
 */
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
        long totalUsedQuota, AmazonWebStorage.QuotaUpdater quotaUpdater)
{
    LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d  currentQuota: %d  totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);

    if (estimatedSize < MAX_QUOTA)
    {
        //increase for 1Mb
        long newQuota = estimatedSize;
        LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
        quotaUpdater.updateQuota(newQuota);
    }
    else
    {
        // Set the quota to whatever it is and force an error
        // TODO: get docs on how to handle this properly
        quotaUpdater.updateQuota(currentQuota);
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:31,代碼來源:InAppChromeClient.java

示例4: onReceivedError

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
 * The errorCode parameter corresponds to one of the ERROR_* constants.
 *
 * @param view          The WebView that is initiating the callback.
 * @param errorCode     The error code corresponding to an ERROR_* value.
 * @param description   A String describing the error.
 * @param failingUrl    The url that failed to load.
 */
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
    // Ignore error due to stopLoading().
    if (!isCurrentlyLoading) {
        return;
    }
    LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl);

    // If this is a "Protocol Not Supported" error, then revert to the previous
    // page. If there was no previous page, then punt. The application's config
    // is likely incorrect (start page set to sms: or something like that)
    if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) {
        parentEngine.client.clearLoadTimeoutTimer();

        if (view.canGoBack()) {
            view.goBack();
            return;
        } else {
            super.onReceivedError(view, errorCode, description, failingUrl);
        }
    }
    parentEngine.client.onReceivedError(errorCode, description, failingUrl);
}
 
開發者ID:jeremyup,項目名稱:cordova-plugin-x5-webview,代碼行數:33,代碼來源:X5WebViewClient.java

示例5: stopRecording

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Stop/Pause recording and save to the file specified when recording started.
 */
public void stopRecording(boolean stop) {
    if (this.recorder != null) {
        try{
            if (this.state == STATE.MEDIA_RUNNING) {
                this.recorder.stop();
            }
            this.recorder.reset();
            if (!this.tempFiles.contains(this.tempFile)) {
                this.tempFiles.add(this.tempFile);
            }
            if (stop) {
                LOG.d(LOG_TAG, "stopping recording");
                this.setState(STATE.MEDIA_STOPPED);
                this.moveFile(this.audioFile);
            } else {
                LOG.d(LOG_TAG, "pause recording");
                this.setState(STATE.MEDIA_PAUSED);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:28,代碼來源:AudioPlayer.java

示例6: 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

示例7: requestAllPaths

import org.apache.cordova.LOG; //導入方法依賴的package包/類
private JSONObject requestAllPaths() throws JSONException {
    Context context = cordova.getActivity();
    JSONObject ret = new JSONObject();
    ret.put("applicationDirectory", "file:///android_asset/");
    ret.put("applicationStorageDirectory", toDirUrl(context.getFilesDir().getParentFile()));
    ret.put("dataDirectory", toDirUrl(context.getFilesDir()));
    ret.put("cacheDirectory", toDirUrl(context.getCacheDir()));
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
      try {
        ret.put("externalApplicationStorageDirectory", toDirUrl(context.getExternalFilesDir(null).getParentFile()));
        ret.put("externalDataDirectory", toDirUrl(context.getExternalFilesDir(null)));
        ret.put("externalCacheDirectory", toDirUrl(context.getExternalCacheDir()));
        ret.put("externalRootDirectory", toDirUrl(Environment.getExternalStorageDirectory()));
      }
      catch(NullPointerException e) {
        /* If external storage is unavailable, context.getExternal* returns null */
          LOG.d(LOG_TAG, "Unable to access these paths, most liklely due to USB storage");
      }
    }
    return ret;
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:22,代碼來源:FileUtils.java

示例8: execute

import org.apache.cordova.LOG; //導入方法依賴的package包/類
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    LOG.d(TAG, "We are entering execute");
    context = callbackContext;
    if(action.equals("getPermission"))
    {
        if(hasPermisssion())
        {
            PluginResult r = new PluginResult(PluginResult.Status.OK);
            context.sendPluginResult(r);
            return true;
        }
        else {
            PermissionHelper.requestPermissions(this, 0, permissions);
        }
        return true;
    }
    return false;
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:19,代碼來源:Geolocation.java

示例9: addWhiteListEntry

import org.apache.cordova.LOG; //導入方法依賴的package包/類
public void addWhiteListEntry(String origin, boolean subdomains) {
    if (whiteList != null) {
        try {
            // Unlimited access to network resources
            if (origin.compareTo("*") == 0) {
                LOG.d(TAG, "Unlimited access to network resources");
                whiteList = null;
            }
            else { // specific access
                Pattern parts = Pattern.compile("^((\\*|[A-Za-z-]+):(//)?)?(\\*|((\\*\\.)?[^*/:]+))?(:(\\d+))?(/.*)?");
                Matcher m = parts.matcher(origin);
                if (m.matches()) {
                    String scheme = m.group(2);
                    String host = m.group(4);
                    // Special case for two urls which are allowed to have empty hosts
                    if (("file".equals(scheme) || "content".equals(scheme)) && host == null) host = "*";
                    String port = m.group(8);
                    String path = m.group(9);
                    if (scheme == null) {
                        // XXX making it stupid friendly for people who forget to include protocol/SSL
                        whiteList.add(new URLPattern("http", host, port, path));
                        whiteList.add(new URLPattern("https", host, port, path));
                    } else {
                        whiteList.add(new URLPattern(scheme, host, port, path));
                    }
                }
            }
        } catch (Exception e) {
            LOG.d(TAG, "Failed to add origin %s", origin);
        }
    }
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:33,代碼來源:Whitelist.java

示例10: onExceededDatabaseQuota

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Handle database quota exceeded notification.
 */
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
        long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
    LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d  currentQuota: %d  totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
    quotaUpdater.updateQuota(MAX_QUOTA);
}
 
開發者ID:runner525,項目名稱:x5webview-cordova-plugin,代碼行數:11,代碼來源:X5WebChromeClient.java

示例11: getPathFromUri

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Get an input stream based on file path or uri content://, http://, file://
 *
 * @param path path to file
 * @return an input stream
 * @throws IOException
 */
private InputStream getPathFromUri(String path) throws IOException {
    if (path.startsWith("data:")) { // data:image/png;base64,[ENCODED_IMAGE]
        String dataInfos = path.substring(0, path.indexOf(','));
        dataInfos = dataInfos.substring(dataInfos.indexOf(':') + 1);
        String baseEncoding = dataInfos.substring(dataInfos.indexOf(';') + 1);
        // [ENCODED_IMAGE]
        if("base64".equalsIgnoreCase(baseEncoding)) {
            String img = path.substring(path.indexOf(',') + 1); 
            byte[] encodedData = img.getBytes();
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(encodedData, 0, encodedData.length);
            Base64InputStream base64InputStream = new Base64InputStream(byteArrayInputStream, Base64.DEFAULT);
            return base64InputStream;
        } else {
            LOG.d(LOG_TAG, "Could not decode image. The found base encoding is " + baseEncoding);
        }
    }  
    if (path.startsWith("content:")) {
        Uri uri = Uri.parse(path);
        return mApp.getActivity().getContentResolver().openInputStream(uri);
    }

    if (path.startsWith(ASSET_URL_PREFIX)) {
        String assetRelativePath = path.replace(ASSET_URL_PREFIX, "");
        return mApp.getActivity().getAssets().open(assetRelativePath);
    }

    if (path.startsWith("http:") || path.startsWith("https:") || path.startsWith("file:")) {
        URL url = new URL(path);
        return url.openStream();
    }

    return new FileInputStream(path);
}
 
開發者ID:rodrigonsh,項目名稱:alerta-fraude,代碼行數:41,代碼來源:ContactAccessorSdk5.java

示例12: getConnectionInfo

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Get the latest network connection information
 *
 * @param info the current active network info
 * @return a JSONObject that represents the network info
 */
private JSONObject getConnectionInfo(NetworkInfo info) {
    String type = TYPE_NONE;
    String extraInfo = "";
    if (info != null) {
        // If we are not connected to any network set type to none
        if (!info.isConnected()) {
            type = TYPE_NONE;
        }
        else {
            type = getType(info);
        }
        extraInfo = info.getExtraInfo();
    }

    LOG.d(LOG_TAG, "Connection Type: " + type);
    LOG.d(LOG_TAG, "Connection Extra Info: " + extraInfo);

    JSONObject connectionInfo = new JSONObject();

    try {
        connectionInfo.put("type", type);
        connectionInfo.put("extraInfo", extraInfo);
    } catch (JSONException e) {
        LOG.d(LOG_TAG, e.getLocalizedMessage());
    }

    return connectionInfo;
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:35,代碼來源:NetworkManager.java

示例13: enableRemoteDebugging

import org.apache.cordova.LOG; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.KITKAT)
private void enableRemoteDebugging() {
    try {
        WebView.setWebContentsDebuggingEnabled(true);
    } catch (IllegalArgumentException e) {
        LOG.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
        e.printStackTrace();
    }
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:10,代碼來源:SystemWebViewEngine.java

示例14: queueCommand

import org.apache.cordova.LOG; //導入方法依賴的package包/類
private void queueCommand(BLECommand command) {
    LOG.d(TAG,"Queuing Command " + command);
    commandQueue.add(command);

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

    if (!bleProcessing) {
        processCommands();
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:13,代碼來源:Peripheral.java

示例15: onActivityResult

import org.apache.cordova.LOG; //導入方法依賴的package包/類
/**
 * Receive File Data from File Chooser
 *
 * @param requestCode the requested code from chromeclient
 * @param resultCode the result code returned from android system
 * @param intent the data from android file chooser
 */
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // For Android >= 5.0
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        LOG.d(LOG_TAG, "onActivityResult (For Android >= 5.0)");
        // If RequestCode or Callback is Invalid
        if(requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null) {
            super.onActivityResult(requestCode, resultCode, intent);
            return;
        }
        mUploadCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
        mUploadCallbackLollipop = null;
    }
    // For Android < 5.0
    else {
        LOG.d(LOG_TAG, "onActivityResult (For Android < 5.0)");
        // If RequestCode or Callback is Invalid
        if(requestCode != FILECHOOSER_REQUESTCODE || mUploadCallback == null) {
            super.onActivityResult(requestCode, resultCode, intent);
            return;
        }

        if (null == mUploadCallback) return;
        Uri result = intent == null || resultCode != cordova.getActivity().RESULT_OK ? null : intent.getData();

        mUploadCallback.onReceiveValue(result);
        mUploadCallback = null;
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:36,代碼來源:InAppBrowser.java


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