List of usage examples for android.util Log VERBOSE
int VERBOSE
To view the source code for android.util Log VERBOSE.
Click Source Link
From source file:com.phonemetra.turbo.lockclock.weather.OpenWeatherMapProvider.java
private WeatherInfo handleWeatherRequest(String selection, String localizedCityName, boolean metric) { String units = metric ? "metric" : "imperial"; String locale = getLanguageCode(); String conditionUrl = String.format(Locale.US, URL_WEATHER, selection, units, locale); String conditionResponse = HttpRetriever.retrieve(conditionUrl); if (conditionResponse == null) { return null; }/*from w ww. ja v a 2 s.c o m*/ String forecastUrl = String.format(Locale.US, URL_FORECAST, selection, units, locale); String forecastResponse = HttpRetriever.retrieve(forecastUrl); if (forecastResponse == null) { return null; } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "URL = " + conditionUrl + " returning a response of " + conditionResponse); } try { JSONObject conditions = new JSONObject(conditionResponse); JSONObject weather = conditions.getJSONArray("weather").getJSONObject(0); JSONObject conditionData = conditions.getJSONObject("main"); JSONObject windData = conditions.getJSONObject("wind"); ArrayList<DayForecast> forecasts = parseForecasts(new JSONObject(forecastResponse).getJSONArray("list"), metric); int speedUnitResId = metric ? R.string.weather_kph : R.string.weather_mph; if (localizedCityName == null) { localizedCityName = conditions.getString("name"); } WeatherInfo w = new WeatherInfo(mContext, conditions.getString("id"), localizedCityName, /* condition */ weather.getString("main"), /* conditionCode */ mapConditionIconToCode(weather.getString("icon"), weather.getInt("id")), /* temperature */ sanitizeTemperature(conditionData.getDouble("temp"), metric), /* tempUnit */ metric ? "C" : "F", /* humidity */ (float) conditionData.getDouble("humidity"), /* wind */ (float) windData.getDouble("speed"), /* windDir */ windData.getInt("deg"), /* speedUnit */ mContext.getString(speedUnitResId), forecasts, System.currentTimeMillis()); Log.d(TAG, "Weather updated: " + w); return w; } catch (JSONException e) { Log.w(TAG, "Received malformed weather data (selection = " + selection + ", lang = " + locale + ")", e); } return null; }
From source file:com.bearstech.android.myownsync.client.NetworkUtilities.java
/** * Connects to the Voiper server, authenticates the provided username and * password./*from w ww. java2s . com*/ * * @param username The user's username * @param password The user's password * @param handler The hander instance from the calling UI thread. * @param context The context of the calling Activity. * @return boolean The boolean result indicating whether the user was * successfully authenticated. */ public static boolean authenticate(String username, String password, String serveraddr, Handler handler, final Context context) { final HttpResponse resp; final ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair(PARAM_USERNAME, username)); params.add(new BasicNameValuePair(PARAM_PASSWORD, password)); HttpEntity entity = null; try { entity = new UrlEncodedFormEntity(params); } catch (final UnsupportedEncodingException e) { // this should never happen. throw new AssertionError(e); } if (!serveraddr.startsWith("http://")) serveraddr = "http://" + serveraddr; final HttpPost post = new HttpPost(serveraddr + AUTH_URI); post.addHeader(entity.getContentType()); post.setEntity(entity); maybeCreateHttpClient(); try { resp = mHttpClient.execute(post); if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Successful authentication"); } sendResult(true, handler, context); return true; } else { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Error authenticating" + resp.getStatusLine()); } sendResult(false, handler, context); return false; } } catch (final IOException e) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "IOException when getting authtoken", e); } sendResult(false, handler, context); return false; } finally { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "getAuthtoken completing"); } } }
From source file:com.android.talkback.speechrules.NodeSpeechRuleProcessor.java
/** * Returns hint text for a node.// w w w. java 2 s. co m * * @param node The node to provide hint text for. * @return The node's hint text. */ public CharSequence getHintForNode(AccessibilityNodeInfoCompat node) { // Disabled items don't have any hint text. if (!node.isEnabled()) { return null; } for (NodeSpeechRule rule : mRules) { if ((rule instanceof NodeHintRule) && rule.accept(node, null)) { LogUtils.log(this, Log.VERBOSE, "Processing node hint using %s", rule); return ((NodeHintRule) rule).getHintText(mContext, node); } } return null; }
From source file:com.google.android.gcm.GCMRegistrar.java
/** * Checks that the application manifest is properly configured. * <p>//from w w w. j a v a 2s . c o m * A proper configuration means: * <ol> * <li>It creates a custom permission called * {@code PACKAGE_NAME.permission.C2D_MESSAGE}. * <li>It defines at least one {@link BroadcastReceiver} with category * {@code PACKAGE_NAME}. * <li>The {@link BroadcastReceiver}(s) uses the * {@value GCMConstants#PERMISSION_GCM_INTENTS} permission. * <li>The {@link BroadcastReceiver}(s) handles the 3 GCM intents * ({@value GCMConstants#INTENT_FROM_GCM_MESSAGE}, * {@value GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK}, * and {@value GCMConstants#INTENT_FROM_GCM_LIBRARY_RETRY}). * </ol> * ...where {@code PACKAGE_NAME} is the application package. * <p> * This method should be used during development time to verify that the * manifest is properly set up, but it doesn't need to be called once the * application is deployed to the users' devices. * * @param context application context. * @throws IllegalStateException if any of the conditions above is not met. */ public static void checkManifest(Context context) { PackageManager packageManager = context.getPackageManager(); String packageName = context.getPackageName(); String permissionName = packageName + ".permission.C2D_MESSAGE"; // check permission try { packageManager.getPermissionInfo(permissionName, PackageManager.GET_PERMISSIONS); } catch (NameNotFoundException e) { throw new IllegalStateException("Application does not define permission " + permissionName); } // check receivers PackageInfo receiversInfo; try { receiversInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_RECEIVERS); } catch (NameNotFoundException e) { throw new IllegalStateException("Could not get receivers for package " + packageName); } ActivityInfo[] receivers = receiversInfo.receivers; if (receivers == null || receivers.length == 0) { throw new IllegalStateException("No receiver for package " + packageName); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "number of receivers for " + packageName + ": " + receivers.length); } Set<String> allowedReceivers = new HashSet<String>(); for (ActivityInfo receiver : receivers) { if (GCMConstants.PERMISSION_GCM_INTENTS.equals(receiver.permission)) { allowedReceivers.add(receiver.name); } } if (allowedReceivers.isEmpty()) { throw new IllegalStateException( "No receiver allowed to receive " + GCMConstants.PERMISSION_GCM_INTENTS); } checkReceiver(context, allowedReceivers, GCMConstants.INTENT_FROM_GCM_REGISTRATION_CALLBACK); checkReceiver(context, allowedReceivers, GCMConstants.INTENT_FROM_GCM_MESSAGE); }
From source file:com.google.android.marvin.mytalkback.speechrules.NodeSpeechRuleProcessor.java
/** * Returns hint text for a node./*from w w w. j av a 2s. c o m*/ * * @param node The node to provide hint text for. * @return The node's hint text. */ public CharSequence getHintForNode(AccessibilityNodeInfoCompat node) { for (NodeSpeechRule rule : mRules) { if ((rule instanceof NodeHintRule) && rule.accept(mContext, node)) { LogUtils.log(this, Log.VERBOSE, "Processing node hint using %s", rule); return ((NodeHintRule) rule).getHintText(mContext, node); } } return null; }
From source file:com.android.screenspeak.speechrules.NodeSpeechRuleProcessor.java
/** * Returns hint text for a node./*from w ww. j a v a 2 s . c o m*/ * * @param node The node to provide hint text for. * @return The node's hint text. */ public CharSequence getHintForNode(AccessibilityNodeInfoCompat node) { for (NodeSpeechRule rule : mRules) { if ((rule instanceof NodeHintRule) && rule.accept(node, null)) { LogUtils.log(this, Log.VERBOSE, "Processing node hint using %s", rule); return ((NodeHintRule) rule).getHintText(mContext, node); } } return null; }
From source file:com.google.android.marvin.mytalkback.formatter.TouchExplorationFormatter.java
/** * Formatter that returns an utterance to announce touch exploration. */// w ww . j a v a 2s .c o m @Override public boolean format(AccessibilityEvent event, TalkBackService context, Utterance utterance) { final AccessibilityRecordCompat record = new AccessibilityRecordCompat(event); final AccessibilityNodeInfoCompat sourceNode = record.getSource(); final AccessibilityNodeInfoCompat focusedNode = getFocusedNode(event.getEventType(), sourceNode); // Drop the event if the source node was non-null, but the focus // algorithm decided to drop the event by returning null. if ((sourceNode != null) && (focusedNode == null)) { AccessibilityNodeInfoUtils.recycleNodes(sourceNode); return false; } LogUtils.log(this, Log.VERBOSE, "Announcing node: %s", focusedNode); // Populate the utterance. addDescription(utterance, focusedNode, event, sourceNode); addFeedback(utterance, focusedNode); // By default, touch exploration flushes all other events. utterance.getMetadata().putInt(Utterance.KEY_METADATA_QUEUING, DEFAULT_QUEUING_MODE); // Events formatted by this class should always advance continuous // reading, if active. utterance.addSpokenFlag(FeedbackItem.FLAG_ADVANCE_CONTINUOUS_READING); AccessibilityNodeInfoUtils.recycleNodes(sourceNode, focusedNode); return true; }
From source file:nl.hardijzer.bitonsync.client.NetworkUtilities.java
/** * Connects to the Voiper server, authenticates the provided username and * password./*from w ww . j a va 2 s . co m*/ * * @param username The user's username * @param password The user's password * @param handler The hander instance from the calling UI thread. * @param context The context of the calling Activity. * @return boolean The boolean result indicating whether the user was * successfully authenticated. */ public static boolean authenticate(String username, String password, Handler handler, final Context context) { final HttpResponse resp; final ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair(PARAM_USERNAME, username)); params.add(new BasicNameValuePair(PARAM_PASSWORD, password)); params.add(new BasicNameValuePair(PARAM_METHOD, AUTH_METHOD)); //params.add(new BasicNameValuePair("op","Inloggen")); HttpEntity entity = null; try { entity = new UrlEncodedFormEntity(params); } catch (final UnsupportedEncodingException e) { // this should never happen. throw new AssertionError(e); } final HttpPost post = new HttpPost(SYNC_URI); post.addHeader(entity.getContentType()); post.setEntity(entity); maybeCreateHttpClient(); try { resp = mHttpClient.execute(post); if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Successful authentication"); } String strResponse = EntityUtils.toString(resp.getEntity()); boolean loggedin = strResponse.startsWith("OK "); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, loggedin ? "Auth: true" : "Auth: false"); } sendResult(loggedin, handler, context); return loggedin; } else { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Error authenticating" + resp.getStatusLine()); } sendResult(false, handler, context); return false; } } catch (final IOException e) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "IOException when getting authtoken", e); } sendResult(false, handler, context); return false; } finally { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "getAuthtoken completing"); } } }
From source file:com.digipom.manteresting.android.adapter.NailCursorAdapter.java
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { final View newView; newView = layoutInflater.inflate(R.layout.nail_item, null); final ViewHolder viewHolder = new ViewHolder(); viewHolder.imageLoadingIndicator = newView.findViewById(R.id.imageLoadingIndicator); viewHolder.couldNotLoadImageIndicator = newView.findViewById(R.id.couldNotLoadImageIndicator); viewHolder.loadedImage = (ImageView) newView.findViewById(R.id.loadedImage); viewHolder.retryConnect = (Button) newView.findViewById(R.id.retryConnect); viewHolder.nailDescription = (TextView) newView.findViewById(R.id.nailDescription); viewHolder.nailUserAndCategory = (TextView) newView.findViewById(R.id.nailUserAndCategory); viewHolder.retryConnect.setOnClickListener(new OnClickListener() { @Override//from w w w . j a v a 2s.co m public void onClick(View v) { // To refresh the bitmap, we just need to clear the uri // string from the set of failed downloads. A retry will // clear all failed downloads so the user doesn't have to // retry one by one. if (LoggerConfig.canLog(Log.VERBOSE)) { Log.v(TAG, "retryConnect.onClick(): Clearing failed downloads."); } failedDownloads.clear(); // Can't use the cursor passed in as a parameter as that // cursor can get swapped. if (mCursor != null && !mCursor.isClosed()) { notifyDataSetChanged(); } else { if (LoggerConfig.canLog(Log.VERBOSE)) { Log.v(TAG, "retryConnect.onClick(): Did not call notifyDataSetChanged() as cursor is invalid."); } } } }); newView.setTag(viewHolder); return newView; }
From source file:com.salesforce.marketingcloud.android.demoapp.LearningAppApplication.java
/** * The onCreate() method initialize your app. * <p/>/* www. j a v a 2 s . c o m*/ * In {@link MarketingCloudConfig.Builder} you must set several parameters: * <ul> * <li> * AppId and AccessToken: these values are taken from the Marketing Cloud definition for your app. * </li> * <li> * SenderID for the push notifications: this value is taken from the Google API console. * </li> * <li> * You also set whether you enable LocationManager, CloudPages, and Analytics. * </li> * </ul> **/ @Override public void onCreate() { super.onCreate(); sharedPreferences = getSharedPreferences("AndroidLearningApp", Context.MODE_PRIVATE); /** Register to receive push notifications. */ MarketingCloudSdk.setLogLevel(BuildConfig.DEBUG ? Log.VERBOSE : Log.ERROR); MarketingCloudSdk.setLogListener(new MCLogListener.AndroidLogListener()); MarketingCloudSdk.init(this, MarketingCloudConfig.builder() // // PROVIDE YOUR APPLICATION'S VALUES .setApplicationId() // ENTER YOUR MARKETING CLOUD APPLICATION ID HERE .setAccessToken() // ENTER YOUR MARKETING CLOUD ACCESS TOKEN HERE .setSenderId() // ENTER YOUR GOOGLE SENDER ID HERE // ENABLE MARKETING CLOUD FEATURES .setAnalyticsEnabled(ANALYTICS_ENABLED).setPiAnalyticsEnabled(PI_ENABLED) .setInboxEnabled(INBOX_ENABLED).setGeofencingEnabled(LOCATION_ENABLED) .setProximityEnabled(PROXIMITY_ENABLED) .setNotificationCustomizationOptions( NotificationCustomizationOptions.create(R.drawable.ic_stat_app_logo_transparent)) .build(this), this); MarketingCloudSdk.requestSdk(new MarketingCloudSdk.WhenReadyListener() { @Override public void ready(MarketingCloudSdk sdk) { sdk.getRegistrationManager().registerForRegistrationEvents(LearningAppApplication.this); sdk.getRegionMessageManager().registerGeofenceMessageResponseListener(LearningAppApplication.this); sdk.getRegionMessageManager().registerProximityMessageResponseListener(LearningAppApplication.this); } }); }