Example usage for android.util Log v

List of usage examples for android.util Log v

Introduction

In this page you can find the example usage for android.util Log v.

Prototype

public static int v(String tag, String msg) 

Source Link

Document

Send a #VERBOSE log message.

Usage

From source file:co.uk.gauntface.mobile.devicelab.receiver.PushNotificationReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Log.v(C.TAG, "PushNotificationReceiver: Received Notification");

    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
    String messageType = gcm.getMessageType(intent);

    if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
        //sendNotification("Send error: " + intent.getExtras().toString());
        Log.e(C.TAG, "PushNotificationReceiver: MESSAGE_TYPE_SEND_ERROR");
    } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
        Log.e(C.TAG, "PushNotificationReceiver: MESSAGE_TYPE_DELETED");
    } else {/* ww w . ja v  a 2 s.c om*/
        Bundle data = intent.getExtras();
        if (data != null) {
            String dataString = data.getString("data");
            Log.v(C.TAG, "PushNotificationReceiver: dataString = " + dataString);
            try {
                JSONObject dataObject = new JSONObject(dataString);
                String url = validateUrl(dataObject.optString("url"));
                String packageName = dataObject.optString("pkg");
                if (url != null) {
                    launchBrowserTask(context, url, packageName);
                }
            } catch (JSONException e) {
                Log.e(C.TAG, "PushNotificationReceiver: JSONException ", e);
            }

        }
    }

    setResultCode(Activity.RESULT_OK);
}

From source file:com.memetro.android.notifications.NotificationUtils.java

/**
 * Stores the registration id, app versionCode, and expiration time in the
 * application's {@code SharedPreferences}.
 *
 * @param context application's context.
 * @param regId registration id//from w ww.ja  va 2  s .  c o m
 */
public static void setRegistrationId(Context context, String regId) {
    final SharedPreferences prefs = getGCMPreferences(context);
    int appVersion = getAppVersion(context);
    Log.v(TAG, "Saving regId on app version " + appVersion);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putString(PROPERTY_REG_ID, regId);
    editor.putInt(PROPERTY_APP_VERSION, appVersion);
    long expirationTime = System.currentTimeMillis() + REGISTRATION_EXPIRY_TIME_MS;

    Log.v(TAG, "Setting registration expiry time to " + new Timestamp(expirationTime));
    editor.putLong(PROPERTY_ON_SERVER_EXPIRATION_TIME, expirationTime);
    editor.commit();
}

From source file:no.uka.findmyapp.android.rest.client.RestIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Log.v(debug, "Inside onHandleIntent");
    Log.v(debug, "" + new Date() + ", In onHandleIntent for thread id = " + Thread.currentThread().getId());

    Bundle bundle = intent.getExtras();/* w  ww .j a  va  2 s .  c o m*/

    Log.v(debug, "onHandleIntent bundle recived");

    ServiceModel serviceModel = (ServiceModel) bundle.get(IntentMessages.SERVICE_MODEL_PACKAGE);

    Credentials credentials = (Credentials) bundle.get(IntentMessages.CREDENTIALS_PACKAGE);

    createRestProcessor(credentials);

    String userToken = "";
    if (bundle.containsKey(IntentMessages.USER_TOKEN_PACKAGE)) {
        userToken = (String) bundle.get(IntentMessages.USER_TOKEN_PACKAGE);
    }

    Log.v(debug, "onHandleIntent: Sending " + serviceModel + " to the rest processor");
    restProcessor.callRest(serviceModel, userToken);

    Log.v(debug, "" + new Date() + ", This thread is waked up.");
}

From source file:com.finlay.geomonsters.MyIOCallback.java

@Override
public void on(String event, IOAcknowledge arg1, Object... arg2) {
    try {//from   www.j a  v a2  s.  c o  m

        Log.v(TAG, "Server triggered event '" + event + "'");
        JSONObject obj = (JSONObject) arg2[0];

        if (event.equals("message"))
            Log.v(TAG, "Message from server: " + obj.getString("message"));
        if (event.equals("result")) {
            Log.v(TAG, "Return from server: " + obj.getString("value"));
            _mainActivity.appendMessage("Return from server: " + obj.getString("value"));
            _mainActivity.launchBattle(obj.getString("value"));
        }
    } catch (JSONException e) {
        Log.e(TAG, e.getMessage());
    }
}

From source file:eu.masconsult.bgbanking.utils.DumpHeadersRequestInterceptor.java

@Override
public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
    for (Header header : request.getAllHeaders()) {
        Log.v(TAG, "> " + header);
    }/*  ww  w  .j  a  va2  s  .  c om*/
}

From source file:eu.masconsult.bgbanking.utils.DumpHeadersResponseInterceptor.java

@Override
public void process(HttpResponse response, HttpContext context) throws HttpException, IOException {
    for (Header header : response.getAllHeaders()) {
        Log.v(TAG, "< " + header);
    }//w  ww.j a v a2  s.  c o m
}

From source file:Main.java

private static String generateSignature(String base, String type, String nonce, String timestamp, String token,
        String tokenSecret, String verifier, ArrayList<String> parameters)
        throws NoSuchAlgorithmException, InvalidKeyException {
    String encodedBase = Uri.encode(base);

    StringBuilder builder = new StringBuilder();

    //Create an array of all the parameters
    //So that we can sort them
    //OAuth requires that we sort all parameters
    ArrayList<String> sortingArray = new ArrayList<String>();

    sortingArray.add("oauth_consumer_key=" + oauthConsumerKey);
    sortingArray.add("oauth_nonce=" + nonce);
    sortingArray.add("oauth_signature_method=HMAC-SHA1");
    sortingArray.add("oauth_timestamp=" + timestamp);
    sortingArray.add("oauth_version=1.0");

    if (parameters != null) {
        sortingArray.addAll(parameters);
    }//from www  .  ja  v  a 2  s  . com

    if (token != "" && token != null) {
        sortingArray.add("oauth_token=" + token);
    }
    if (verifier != "" && verifier != null) {
        sortingArray.add("oauth_verifier=" + verifier);
    }

    Collections.sort(sortingArray);

    //Append all parameters to the builder in the right order
    for (int i = 0; i < sortingArray.size(); i++) {
        if (i > 0)
            builder.append("&" + sortingArray.get(i));
        else
            builder.append(sortingArray.get(i));

    }

    String params = builder.toString();
    //Percent encoded the whole url
    String encodedParams = Uri.encode(params);

    String completeUrl = type + "&" + encodedBase + "&" + encodedParams;

    String completeSecret = oauthSecretKey;

    if (tokenSecret != null && tokenSecret != "") {
        completeSecret = completeSecret + "&" + tokenSecret;
    } else {
        completeSecret = completeSecret + "&";
    }

    Log.v("Complete URL: ", completeUrl);
    Log.v("Complete Key: ", completeSecret);

    Mac mac = Mac.getInstance("HmacSHA1");
    SecretKeySpec secret = new SecretKeySpec(completeSecret.getBytes(), mac.getAlgorithm());
    mac.init(secret);
    byte[] sig = mac.doFinal(completeUrl.getBytes());

    String signature = Base64.encodeToString(sig, 0);
    signature = signature.replace("+", "%2b"); //Specifically encode all +s to %2b

    return signature;
}

From source file:com.jeffreyawest.http.HTTPAdapterImpl.java

private static String doHTTPMethod(HttpRequestBase pRequest) throws Exception {

    InputStream is = null;//from w w w  .  java2 s .co  m
    StringBuilder sb = new StringBuilder();
    DefaultHttpClient httpClient = new DefaultHttpClient();

    Log.v(LOG_TAG, "doHTTPMethod()");

    try {
        HttpResponse httpResponse = httpClient.execute(pRequest);
        Log.v("HTTPAdapter.doHTTPMethod", "HTTP Status:" + httpResponse.getStatusLine());
        if (httpResponse.getStatusLine().getStatusCode() != 200) {
            throw new Exception("HTTP Error: " + httpResponse.getStatusLine());
        }
        HttpEntity httpEntity = httpResponse.getEntity();
        is = httpEntity.getContent();
    } catch (Exception e) {
        throw e;
    }

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8);

        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line).append("\n");
        }
        is.close();
    } catch (Exception e) {
        Log.e("Buffer Error", "Error converting result " + e.toString());
    }
    return sb.toString();
}

From source file:com.dw.bartinter.BarTinter.java

@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    Log.v(PLUGIN, "StatusBar: initialization");
    super.initialize(cordova, webView);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        String statusBarColor = preferences.getString("StatusBarColor", "#000000");
        String navigationBarColor = preferences.getString("NavigationBarColor", "#000000");
        if (!statusBarColor.isEmpty()) {
            statusBar(statusBarColor);//from   w w  w .j av a  2 s .  c  o  m
        }
        if (!navigationBarColor.isEmpty()) {
            navigationBar(navigationBarColor);
        }
    }
}

From source file:dtu.ds.warnme.app.ws.client.https.GsonHttpResponseHandler.java

@Override
@Deprecated/*from  w  ww  . j  a  v  a2  s .  com*/
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
    try {
        String response = responseBody != null ? new String(responseBody, getCharset()) : StringUtils.EMPTY;
        onFailure(statusCode, headers, response, error);
    } catch (UnsupportedEncodingException e) {
        Log.v(TAG, "String encoding failed, calling onFailure(int, Header[], String, Throwable)");
        onFailure(0, headers, (String) null, e);
    }
}