List of usage examples for android.util Log v
public static int v(String tag, String msg)
From source file:au.com.micropacific.cordova.CipherlabRS30Plugin.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { //System.out.println("============== execute ==========="); Log.v("CipherlabRS30Plugin", "============== execute ===========: " + action); if (action.equals("echo")) { String message = args.getString(0); this.echo(message, callbackContext); return true; }// www . j av a 2s. co m if (action.equals("initialise")) { this.initialise(callbackContext); return true; } if (action.equals("setReceiveScanCallback")) { Log.v("CipherlabRS30Plugin", " ==== setReceiveScanCallback ==="); receiveScanCallback = callbackContext; if (callbackContext == null) { Log.v("CipherlabRS30Plugin", "callbackContext is null."); } else { Log.v("CipherlabRS30Plugin", "callbackContext is not null"); } return true; } if (action.equals("requestScan")) { //Log.v("CipherlabRS30Plugin", "requestScan"); if (mReaderManager != null) { mReaderManager.SoftScanTrigger(); } return true; } if (action.equals("destroy")) { if (mReaderManager != null) { // Call this from window.onbeforeunload Log.v("CipherlabRS30Plugin", "destroy(): cleaning up."); cordova.getActivity().unregisterReceiver(mDataReceiver); mReaderManager.Release(); mDataReceiver = null; mReaderManager = null; } return true; } Log.v("CipherlabRS30Plugin", "============== done ===========: " + action); return false; }
From source file:com.oneteam.framework.android.location.direction.parser.DirectionsJSONParser.java
/** * Receives a JSONObject and returns a GDirection * /*from w w w . jav a 2 s .co m*/ * @param jObject * The Json to parse * @return The GDirection defined by the JSon Object */ public List<GDirection> parse(JSONObject jObject) { // The returned direction List<GDirection> directionsList = new ArrayList<GDirection>(); // The current GDirection GDirection currentGDirection = null; // The legs List<GDLegs> legs = new ArrayList<GDLegs>(); // The current leg GDLegs currentLeg = null; // The paths List<GDPath> paths = new ArrayList<GDPath>(); // The current path GDPath currentPath = null; // JSON Array representing Routes JSONArray jRoutes = null; JSONObject jRoute; JSONObject jBound; // JSON Array representing Legs JSONArray jLegs = null; JSONObject jLeg; // JSON Array representing Step JSONArray jSteps = null; JSONObject jStep; String polyline = ""; try { jRoutes = jObject.getJSONArray("routes"); Log.v(tag, "routes found : " + jRoutes.length()); /** Traversing all routes */ for (int i = 0; i < jRoutes.length(); i++) { jRoute = (JSONObject) jRoutes.get(i); jLegs = jRoute.getJSONArray("legs"); Log.v(tag, "routes[" + i + "]contains jLegs found : " + jLegs.length()); /** Traversing all legs */ for (int j = 0; j < jLegs.length(); j++) { jLeg = (JSONObject) jLegs.get(j); jSteps = jLeg.getJSONArray("steps"); Log.v(tag, "routes[" + i + "]:legs[" + j + "] contains jSteps found : " + jSteps.length()); /** Traversing all steps */ for (int k = 0; k < jSteps.length(); k++) { jStep = (JSONObject) jSteps.get(k); polyline = (String) ((JSONObject) (jStep).get("polyline")).get("points"); // Build the List of GDPoint that define the path List<GDPoint> list = decodePoly(polyline); // Create the GDPath currentPath = new GDPath(list); currentPath.setDistance(((JSONObject) jStep.get("distance")).getInt("value")); currentPath.setDuration(((JSONObject) jStep.get("duration")).getInt("value")); currentPath.setHtmlText(jStep.getString("html_instructions")); currentPath.setTravelMode(jStep.getString("travel_mode")); Log.v(tag, "routes[" + i + "]:legs[" + j + "]:Step[" + k + "] contains Points found : " + list.size()); // Add it to the list of Path of the Direction paths.add(currentPath); } // currentLeg = new GDLegs(paths); currentLeg.setmDistance(((JSONObject) jLeg.get("distance")).getInt("value")); currentLeg.setmDuration(((JSONObject) jLeg.get("duration")).getInt("value")); currentLeg.setmEndAddress(jLeg.getString("end_address")); currentLeg.setmStartAddress(jLeg.getString("start_address")); legs.add(currentLeg); Log.v(tag, "Added a new Path and paths size is : " + paths.size()); } // Build the GDirection using the paths found currentGDirection = new GDirection(legs); jBound = (JSONObject) jRoute.get("bounds"); currentGDirection .setmNorthEastBound(new LatLng(((JSONObject) jBound.get("northeast")).getDouble("lat"), ((JSONObject) jBound.get("northeast")).getDouble("lng"))); currentGDirection .setmSouthWestBound(new LatLng(((JSONObject) jBound.get("southwest")).getDouble("lat"), ((JSONObject) jBound.get("southwest")).getDouble("lng"))); currentGDirection.setCopyrights(jRoute.getString("copyrights")); directionsList.add(currentGDirection); } } catch (JSONException e) { Log.e(tag, "Parsing JSon from GoogleDirection Api failed, see stack trace below:", e); } catch (Exception e) { Log.e(tag, "Parsing JSon from GoogleDirection Api failed, see stack trace below:", e); } return directionsList; }
From source file:com.goliathonline.android.kegbot.io.RemoteUserHandler.java
/** {@inheritDoc} */ @Override// w w w . j a v a2s. c o m public ArrayList<ContentProviderOperation> parse(JSONObject parser, ContentResolver resolver) throws JSONException, IOException { final ArrayList<ContentProviderOperation> batch = Lists.newArrayList(); // Walk document, parsing any incoming entries if (!parser.has("result")) return batch; JSONObject result = parser.getJSONObject("result"); JSONObject keg = result.getJSONObject("user"); final String userId = sanitizeId(keg.getString("username")); final Uri userUri = Users.buildUserUri(userId); // Check for existing details, only update when changed final ContentValues values = queryUserDetails(userUri, resolver); final long localUpdated = values.getAsLong(SyncColumns.UPDATED); final long serverUpdated = 500; //entry.getUpdated(); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "found user " + userId); Log.v(TAG, "found localUpdated=" + localUpdated + ", server=" + serverUpdated); } // Clear any existing values for this session, treating the // incoming details as authoritative. batch.add(ContentProviderOperation.newDelete(userUri).build()); final ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(Users.CONTENT_URI); builder.withValue(SyncColumns.UPDATED, serverUpdated); builder.withValue(Users.USER_ID, userId); if (keg.has("image")) { JSONObject image = keg.getJSONObject("image"); if (image.has("url")) builder.withValue(Users.USER_IMAGE_URL, image.getString("url")); } // Normal session details ready, write to provider batch.add(builder.build()); return batch; }
From source file:net.kayateia.lifestream.UploadService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i(LOG_TAG, "UploadService kicked"); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); final PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, ""); // See CaptureService for comments on this wake lock arrangement. boolean needsRelease = true; try {/*from w w w . j a va 2 s . co m*/ // If we don't release it within the timeout somehow, release it anyway. // This may interrupt a long backlog upload or something, but this // is really about as long as we can reasonably expect to take. Log.v(LOG_TAG, "Acquire wakelock"); if (wl != null) wl.acquire(WAKELOCK_TIMEOUT); if (!Network.IsActive(this)) { Log.i(LOG_TAG, "No network active, giving up"); return START_NOT_STICKY; } // Do the check in a thread. new AsyncTask<UploadService, Void, Void>() { @Override protected Void doInBackground(UploadService... svc) { svc[0].checkUploads(); return null; } @Override protected void onPostExecute(Void foo) { Log.v(LOG_TAG, "Release wakelock by worker"); if (wl != null && wl.isHeld()) wl.release(); } }.execute(this); needsRelease = false; } finally { if (needsRelease) { Log.v(LOG_TAG, "Release wakelock by default"); if (wl != null && wl.isHeld()) wl.release(); } } // There's no need to worry about this.. we'll get re-kicked by the alarm. return START_NOT_STICKY; }
From source file:eu.masconsult.bgbanking.accounts.AccountAuthenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Log.v(TAG, "addAccount(type: " + accountType + ", authTokenType: " + authTokenType + ")"); final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(KEY_ACCOUNT_TYPE, accountType); final Bundle bundle = new Bundle(); bundle.putParcelable(KEY_INTENT, intent); return bundle; }
From source file:luis.clientebanco.OAuth.UrbankOAuth.java
public void urbankLogin(Context mContext) { webService = new WebService(); String authRequestRedirect = AppContext.UB_APP_OAUTH_URL + "?client_id=" + AppContext.UB_CLIENT_ID + "&redirect_uri=" + AppContext.UB_APP_REDIRECT + "&response_type=code" + "&scope=permission_read_transaction"; if (LOGGING.DEBUG) Log.d(TAG, "authRequestRedirect->" + authRequestRedirect); new UrbankOAuthDialog(mContext, authRequestRedirect, new GenericDialogListener() { public void onComplete(Bundle values) { if (LOGGING.DEBUG) Log.d(TAG, "onComplete->" + values); accessCode = ""; try { accessCode = values.getString("code"); new urbankAccessToken().execute(); } catch (Exception ex1) { Log.w(TAG, ex1.toString()); accessCode = null;/*from w w w .ja v a2 s. c o m*/ } Log.v(TAG, "prueba"); } public void onError(String e) { if (LOGGING.DEBUG) Log.d(TAG, "onError->" + e); } public void onCancel() { if (LOGGING.DEBUG) Log.d(TAG, "onCancel()"); } }).show(); }
From source file:com.phonegap.bossbolo.plugin.BoloPlugin.java
/** * Sets the context of the Command. This can then be used to do things like * get file paths associated with the Activity. * * @param cordova The context of the main Activity. * @param webView The CordovaWebView Cordova is running in. *//*from w w w . j a va 2s . c o m*/ @Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { Log.v(TAG, "StatusBar: initialization"); super.initialize(cordova, webView); this.webView = webView; this.activity = cordova.getActivity(); this.window = this.activity.getWindow(); this.mContext = this.webView.getContext(); ConfigXmlParser parser = new ConfigXmlParser(); CustomGlobal.getInstance().setLaunchUrl(parser.getLaunchUrl()); UmengUpdateAgent.setUpdateOnlyWifi(false); UmengUpdateAgent.setUpdateAutoPopup(false); UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() { @Override public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) { if (updateStatus == UpdateStatus.Yes) { haveUpdate = true; UmengUpdateAgent.showUpdateDialog(activity.getApplicationContext(), updateInfo); } updateIsCallback = true; } }); /*this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially // by the Cordova. } });*/ }
From source file:com.goliathonline.android.kegbot.io.RemoteKegHandler.java
/** {@inheritDoc} */ @Override//from www. j ava 2 s.com public ArrayList<ContentProviderOperation> parse(JSONObject parser, ContentResolver resolver) throws JSONException, IOException { final ArrayList<ContentProviderOperation> batch = Lists.newArrayList(); // Walk document, parsing any incoming entries JSONObject result = parser.getJSONObject("result"); JSONObject keg = result.getJSONObject("keg"); JSONObject type = result.getJSONObject("type"); JSONObject image = type.getJSONObject("image"); final String kegId = sanitizeId(keg.getString("id")); final Uri kegUri = Kegs.buildKegUri(kegId); // Check for existing details, only update when changed final ContentValues values = queryKegDetails(kegUri, resolver); final long localUpdated = values.getAsLong(SyncColumns.UPDATED); final long serverUpdated = 500; //entry.getUpdated(); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "found keg " + kegId); Log.v(TAG, "found localUpdated=" + localUpdated + ", server=" + serverUpdated); } // Clear any existing values for this session, treating the // incoming details as authoritative. batch.add(ContentProviderOperation.newDelete(kegUri).build()); final ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(Kegs.CONTENT_URI); builder.withValue(SyncColumns.UPDATED, serverUpdated); builder.withValue(Kegs.KEG_ID, kegId); // Inherit starred value from previous row if (values.containsKey(Kegs.KEG_STARRED)) { builder.withValue(Kegs.KEG_STARRED, values.getAsInteger(Kegs.KEG_STARRED)); } if (keg.has("status")) builder.withValue(Kegs.STATUS, keg.getString("status")); if (keg.has("volume_ml_remain")) builder.withValue(Kegs.VOLUME_REMAIN, keg.getDouble("volume_ml_remain")); if (keg.has("description")) builder.withValue(Kegs.DESCRIPTION, keg.getString("description")); if (keg.has("type_id")) builder.withValue(Kegs.TYPE_ID, keg.getString("type_id")); if (keg.has("size_id")) builder.withValue(Kegs.SIZE_ID, keg.getInt("size_id")); if (keg.has("percent_full")) builder.withValue(Kegs.PERCENT_FULL, keg.getDouble("percent_full")); if (keg.has("size_name")) builder.withValue(Kegs.SIZE_NAME, keg.getString("size_name")); if (keg.has("spilled_ml")) builder.withValue(Kegs.VOLUME_SPILL, keg.getDouble("spilled_ml")); if (keg.has("size_volume_ml")) builder.withValue(Kegs.VOLUME_SIZE, keg.getDouble("size_volume_ml")); if (type.has("name")) builder.withValue(Kegs.KEG_NAME, type.getString("name")); if (type.has("abv")) builder.withValue(Kegs.KEG_ABV, type.getDouble("abv")); if (image.has("url")) builder.withValue(Kegs.IMAGE_URL, image.getString("url")); // Normal keg details ready, write to provider batch.add(builder.build()); return batch; }
From source file:org.mythtv.service.frontends.v25.StatusHelperV25.java
public Status process(final Context context, final LocationProfile locationProfile, final String url) { Log.v(TAG, "process : enter"); if (!NetworkHelper.getInstance().isFrontendConnected(context, locationProfile, url)) { Log.w(TAG, "process : Frontend @ '" + url + "' is unreachable"); return null; }/*from w ww . j a va 2 s . co m*/ mMythServicesTemplate = (MythServicesTemplate) MythAccessFactory.getServiceTemplateApiByVersion(mApiVersion, url); if (null == mMythServicesTemplate) { Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable"); return null; } Status status = null; try { status = downloadStatus(locationProfile, url); } catch (Exception e) { Log.e(TAG, "process : error", e); status = null; } Log.v(TAG, "process : exit"); return status; }
From source file:com.orange.labs.sdk.exception.CloudAPIException.java
public CloudAPIException(VolleyError error) { super(error); try {//from w w w . j av a 2 s . co m if (error != null && error.networkResponse != null) { this.statusCode = error.networkResponse.statusCode; String str = new String(error.networkResponse.data, "UTF-8"); Log.v("CloudAPIException", str); JSONObject errorJson = new JSONObject(str); if (errorJson != null) { errorJson = errorJson.optJSONObject("error"); if (errorJson != null) { this.code = errorJson.optString("code"); this.message = errorJson.optString("message"); if (TextUtils.isEmpty(this.message)) { this.message = errorJson.optString("label"); } this.description = errorJson.optString("description"); if (TextUtils.isEmpty(this.description)) { this.description = errorJson.optString("details"); } } else { // Identity Error this.code = errorJson.optString("error"); this.message = errorJson.optString("error"); this.description = errorJson.optString("error_description"); } } else { this.message = ""; this.description = ""; this.code = ""; } } } catch (Exception e) { e.printStackTrace(); } }