Example usage for android.util Log i

List of usage examples for android.util Log i

Introduction

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

Prototype

public static int i(String tag, String msg) 

Source Link

Document

Send an #INFO log message.

Usage

From source file:Main.java

public static boolean logout() {
    String baseUrl = "http://10.6.8.2/cgi-bin/srun_portal?action=logout&ac_id=1";

    try {//from   w  ww .j  a v a2  s.  c o  m
        HttpGet getMethod = new HttpGet(baseUrl);
        getMethod.addHeader("Accept", "*/*");
        //getMethod.addHeader("Accept-Language", "zh-cn");
        //getMethod.addHeader("Referer", "http://202.117.2.41/index.html");
        //getMethod.addHeader("Content-Type", "application/x-www-form-urlencoded");
        //getMethod.addHeader("Accept-Encoding", "gzip, deflate");
        //getMethod.addHeader("User-Agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)");
        getMethod.addHeader("Host", "10.6.8.2");
        //getMethod.addHeader("DNT", "1");

        HttpClient httpClient = new DefaultHttpClient();

        HttpResponse response = httpClient.execute(getMethod);
        Log.i(TAG, "Sending message.....");
        HttpEntity httpEntity = response.getEntity();
        if (response.getStatusLine().getStatusCode() == 200) {
            String message = EntityUtils.toString(httpEntity);
            Log.i(TAG, "Logout succeed!!! message=" + message);
            return true;
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    Log.i(TAG, "Logout failed!!!");
    return false;
}

From source file:Main.java

/**
 * Notifies UI to display a message./*from w w w .  ja v a2 s.co m*/
 * <p>
 * This method is defined in the common helper because it's used both by the
 * UI and the background service.
 * 
 * @param context
 *            application's context.
 * @param message
 *            message to be displayed.
 */
public static void displayMessage(Context context, String message) {
    Log.i("CommonUtilities", "================Inside DisplayMessege Method==============================");
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}

From source file:com.amazonaws.cognito.sync.devauth.client.Utilities.java

public static String extractElement(String json, String element) {
    boolean hasElement = (json.indexOf(element) != -1);
    if (hasElement) {
        Log.i("help", json);
        int elementIndex = json.indexOf(element) + element.length() + 1;
        int startIndex = json.indexOf("\"", elementIndex);
        int endIndex = json.indexOf("\"", startIndex + 1);
        Log.i("help", json.substring(startIndex + 1, endIndex));
        return json.substring(startIndex + 1, endIndex);
    }//from  www.ja v a2 s .co m

    return null;
}

From source file:Main.java

public static void setRinger2Vibrate(Context context) {
    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
    Log.i("HelperFunctions ", "Vibrate method called");
}

From source file:GCMService.java

@Override
public void onMessageReceived(String from, Bundle data) {
    super.onMessageReceived(from, data);
    Log.i("GCMService", "onMessageReceived(): " + data.toString());
    sendNotification(data.toString());/*from w w w. j a  v  a2s . c  o  m*/
}

From source file:org.elegosproject.romupdater.DownloadManager.java

public static boolean checkHttpFile(String url) {
    try {//  ww  w . j ava 2s.c  om
        HttpParams httpParameters = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParameters, 3000);
        Log.i(TAG, "Testing " + url + "...");
        URL theUrl = new URL(url);
        HttpURLConnection connection = (HttpURLConnection) theUrl.openConnection();
        if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
            connection.disconnect();
        } else {
            Log.i(TAG, "HTTP Response code: " + connection.getResponseCode());
            return false;
        }
    } catch (IOException e) {
        Log.e(TAG, e.toString());
        return false;
    }
    return true;
}

From source file:com.fsck.k9.mail.store.webdav.WebDavHttpClient.java

public static void modifyRequestToAcceptGzipResponse(HttpRequest request) {
    Log.i(LOG_TAG, "Requesting gzipped data");
    request.addHeader("Accept-Encoding", "gzip");
}

From source file:Main.java

/**
 * Checks if the external media (SD Card) is writable
 *
 * @return boolean True if Writable/*from  ww  w .j  a  v a 2 s  .  c  om*/
 */
public static boolean isSdWritable() {

    boolean mExternalStorageAvailable = false;
    try {
        String state = Environment.getExternalStorageState();

        if (Environment.MEDIA_MOUNTED.equals(state)) {
            // We can read and write the media
            mExternalStorageAvailable = true;
            Log.i(TAG, mTAG + ": External storage card is readable.");
        } else {
            mExternalStorageAvailable = false;
        }
    } catch (Exception ex) {
        Log.e(TAG, mTAG + ":isSdWritable - " + ex.getMessage());
    }
    return mExternalStorageAvailable;
}

From source file:Main.java

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, int maxFPS) {
    List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange();
    Log.i(TAG, "Supported FPS ranges: " + toString(supportedPreviewFpsRanges));
    if (supportedPreviewFpsRanges != null && !supportedPreviewFpsRanges.isEmpty()) {
        int[] suitableFPSRange = null;
        for (int[] fpsRange : supportedPreviewFpsRanges) {
            int thisMin = fpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX];
            int thisMax = fpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX];
            if (thisMin >= minFPS * 1000 && thisMax <= maxFPS * 1000) {
                suitableFPSRange = fpsRange;
                break;
            }//from  w w w  .  j  a  va2s. co m
        }
        if (suitableFPSRange == null) {
            Log.i(TAG, "No suitable FPS range?");
        } else {
            int[] currentFpsRange = new int[2];
            parameters.getPreviewFpsRange(currentFpsRange);
            if (Arrays.equals(currentFpsRange, suitableFPSRange)) {
                Log.i(TAG, "FPS range already set to " + Arrays.toString(suitableFPSRange));
            } else {
                Log.i(TAG, "Setting FPS range to " + Arrays.toString(suitableFPSRange));
                parameters.setPreviewFpsRange(suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],
                        suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]);
            }
        }
    }
}

From source file:Main.java

private static String findSettableValue(String name, Collection<String> supportedValues,
        String... desiredValues) {
    Log.i(TAG, "Requesting " + name + " value from among: " + Arrays.toString(desiredValues));
    Log.i(TAG, "Supported " + name + " values: " + supportedValues);
    if (supportedValues != null) {
        for (String desiredValue : desiredValues) {
            if (supportedValues.contains(desiredValue)) {
                Log.i(TAG, "Can set " + name + " to: " + desiredValue);
                return desiredValue;
            }//from  w w  w .j  a  v  a 2  s .  c  o m
        }
    }
    Log.i(TAG, "No supported values match");
    return null;
}