Example usage for android.util Log d

List of usage examples for android.util Log d

Introduction

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

Prototype

public static int d(String tag, String msg) 

Source Link

Document

Send a #DEBUG log message.

Usage

From source file:inf.ufg.br.muralufg.features.push.GcmSender.java

public static void main(String[] args) {
    if (args.length < 1 || args.length > 2 || args[0] == null) {
        Log.d("", "usage: ./gradlew run -Pargs=\"MESSAGE[,DEVICE_TOKEN]\"");
        Log.d("",
                "Specify a test message to broadcast via GCM. If a device's GCM registration token is\n"
                        + "specified, the message will only be sent to that device. Otherwise, the message \n"
                        + "will be sent to all devices subscribed to the \"global\" topic.");
        Log.d("", "Example (Broadcast):\n" + "On Windows:   .\\gradlew.bat run -Pargs=\"<Your_Message>\"\n"
                + "On Linux/Mac: ./gradlew run -Pargs=\"<Your_Message>\"");

        Log.d("",
                "Example (Unicast):\n"
                        + "On Windows:   .\\gradlew.bat run -Pargs=\"<Your_Message>,<Your_Token>\"\n"
                        + "On Linux/Mac: ./gradlew run -Pargs=\"<Your_Message>,<Your_Token>\"");
        System.exit(1);/*from  w ww .  jav a  2  s  .co  m*/
    }
    try {
        // Prepare JSON containing the GCM message content. What to send and where to send.
        JSONObject jGcmData = new JSONObject();
        JSONObject jData = new JSONObject();
        jData.put("message", args[0].trim());
        // Where to send GCM message.
        if (args.length > 1 && args[1] != null) {
            jGcmData.put("to", args[1].trim());
        } else {
            jGcmData.put("to", "/topics/global");
        }
        // What to send in GCM message.
        jGcmData.put("data", jData);

        // Create connection to send GCM Message request.
        URL url = new URL("https://android.googleapis.com/gcm/send");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestProperty("Authorization", "key=" + API_KEY);
        conn.setRequestProperty("Content-Type", "application/json");
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);

        // Send GCM message content.
        OutputStream outputStream = conn.getOutputStream();
        outputStream.write(jGcmData.toString().getBytes());

        // Read GCM response.
        InputStream inputStream = conn.getInputStream();
        String resp = IOUtils.toString(inputStream);
        Log.d("", resp);
        Log.d("", "Check your device/emulator for notification or logcat for "
                + "confirmation of the receipt of the GCM message.");
    } catch (IOException e) {
        Log.d("", "Unable to send GCM message.");
        Log.d("", "Please ensure that API_KEY has been replaced by the server "
                + "API key, and that the device's registration token is correct (if specified).");
        Log.d("", "", e);
    } catch (JSONException e) {
        Log.d("", "", e);
    }
}

From source file:Main.java

private static void log(String s) {
    Log.d("AppUtils", s);
}

From source file:Main.java

private static void log(String log) {
    Log.d("http", log);
}

From source file:Main.java

public static void log(String msg) {
    Log.d("download_scromp", msg);
}

From source file:Main.java

public static void print(String str) {
    Log.d("TTLog", str);
}

From source file:Main.java

private static void showLog(String msg) {
    Log.d("NetTool", msg);
}

From source file:Main.java

public static void Message(String str) {
    Log.d("TAG",
            "[" + new Throwable().getStackTrace()[0].getFileName() + "]["
                    + new Throwable().getStackTrace()[0].getMethodName() + "]["
                    + new Throwable().getStackTrace()[0].getLineNumber() + "] : " + str);
}

From source file:Main.java

public static void D(String TAG, String msg) {
    Log.d("TAG", TAG + ">>>>>>>> " + msg);
}

From source file:Main.java

public static void debug(String msg) {
    Log.d("WLDroidGap", getMsgNotNull(msg));
}

From source file:Main.java

public static void log(String tag, String info) {
    Log.d(tag, info);
}