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:Main.java

public static String getMetadataInfo(MediaMetadataRetriever retriever, int tag) {
    String value;//  ww w  .  ja va  2 s  .  c  om
    if (tag != -1) {
        value = retriever.extractMetadata(tag);
        Log.d(LOG_TAG, "Return metadata with tag : " + tag + " value: " + value);
        return value;
    }
    retriever.release();
    return null;
}

From source file:Main.java

public static void openGPS(Context context) {
    Log.d(TAG, "openGPS");
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

    if (!locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) {
        Intent gpsIntent = new Intent();
        gpsIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
        gpsIntent.addCategory("android.intent.category.ALTERNATIVE");
        gpsIntent.setData(Uri.parse("custom:3"));
        try {//from   w w  w .  j ava 2s  .c  om
            PendingIntent.getBroadcast(context, 0, gpsIntent, 0).send();

        } catch (CanceledException e) {
            Log.d(TAG, "openGPS exception:" + e.getMessage());

            e.printStackTrace();
        }

    }
}

From source file:Main.java

public static void invokeMethodFormRed5(String toUserId) {
    Date nowDate = new Date();
    String time = nowDate.getTime() + "" + (int) ((Math.random() * 100) % 100);
    message = time;// www. j av  a2  s  . c  om
    //      connection.call("createMeeting", responder, User.id + "", toUserId, message);
    Log.d("DEBUG", "call createMeeting");
}

From source file:Main.java

private static File getAlbumStorageDir(String albumName) {
    // Get the directory for the user's public pictures directory.
    File file = new File(Environment.getExternalStorageDirectory(), albumName);
    if (!file.mkdirs()) {
        Log.d(LOG_TAG, "Directory not created");
    }// ww w.jav a  2s  . co m
    return file;
}

From source file:Main.java

public static String getTopActivity2(Context ctx) {
    ActivityManager am = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);
    Log.d("topActivity", "CURRENT Activity ::" + taskInfo.get(0).topActivity.getClassName());
    ComponentName componentInfo = taskInfo.get(0).topActivity;
    return componentInfo.getPackageName();
}

From source file:Main.java

/**
 * Method to send SMS message//from ww  w . j av  a  2s  .  c o  m
 * 
 * @param phoneNumber The phone number that the message is to be sent to
 * @param body content of the SMS message
 */
public static void sendSms(String phoneNumber, String body) {

    Log.d("WipiwayUtils", "Sending SMS message - " + body + " ... Phone number - " + phoneNumber);

    SmsManager sms = SmsManager.getDefault();
    try {
        sms.sendTextMessage(phoneNumber, null, body, null, null);
    } catch (Exception e) {
        Log.d("WipiwayController", e.toString());
    }

    // Show in outbox - http://stackoverflow.com/a/3873328/804503

}

From source file:Main.java

public static boolean updateFile(String path, String filename) {
    File f = new File(path, filename);
    Log.e("x", f.getAbsolutePath());
    Log.e("x", "" + f.exists());
    long fileTime = f.lastModified();
    long curTime = System.currentTimeMillis();
    long fileAge = curTime - fileTime;

    Log.d("updateFile", "fileTime: " + fileTime);
    Log.d("updateFile", "curTime: " + curTime);
    Log.d("updateFile", "fileage: " + fileAge);

    // return true if file is older than an hour
    return fileAge > (1000 * 60 * 60);

}

From source file:Main.java

public static void MercatorToBD(double mercatorX, double mercatorY) {
    CbdX = mercatorY / 20037508.34 * 180;
    CbdX = 180 / Math.PI * (2 * Math.atan(Math.exp(CbdX * Math.PI / 180)) - Math.PI / 2);
    CbdY = mercatorX / 20037508.34 * 180;

    Log.d("CustomerActivity", "x" + Double.toString(CbdX));
    Log.d("CustomerActivity", "y" + Double.toString(CbdY));
}

From source file:Main.java

static void sendData(byte[] data) throws IOException {
    Log.d(TAG, "sendData data.len:" + data.length);
    while (true) {

        if (multicastSocket == null) {
            multicastSocket = new MulticastSocket(MULTICAST_PORT);
            Log.d(TAG, "new MulticastSocket()");
        }/*from  w w  w . j a  va 2s  .  c o  m*/

        //MulticastSocket multicastSocket = new MulticastSocket(MULTICAST_PORT);
        multicastSocket.setLoopbackMode(true);
        InetAddress group;
        DatagramPacket packet;
        for (int i = 0; i < data.length; i++) {
            Log.d(TAG, i + ":" + data[i]);
            group = InetAddress.getByName("239." + i + "." + data[i] + ".254");

            multicastSocket.joinGroup(group);
            packet = new DatagramPacket("".getBytes(), "".getBytes().length, group, MULTICAST_PORT);
            multicastSocket.send(packet);
            multicastSocket.leaveGroup(group);
        }
    }
}

From source file:Main.java

/**
 * log debug a string/*from w  w w . ja  v  a  2 s  .c  o  m*/
 *
 * @param tag tag for logging
 * @param s   string to be logged
 */
public static void logD(String tag, String s) {
    Log.d(tag, s);
}