Example usage for android.util Log DEBUG

List of usage examples for android.util Log DEBUG

Introduction

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

Prototype

int DEBUG

To view the source code for android.util Log DEBUG.

Click Source Link

Document

Priority constant for the println method; use Log.d.

Usage

From source file:com.variable.demo.api.fragment.MotionFragment.java

@Override
public void onAccelerometerUpdate(MotionSensor sensor, MotionReading reading) {
    DateFormat formatter = new SimpleDateFormat("MM-dd-yyyy hh:mm.ss");

    // Log.d(TAG, "TimeStamp Source: " + reading.getTimeStampSource());
    // Log.d(TAG," Time:" + formatter.format(reading.getTimeStamp()));

    Message m = mHandler.obtainMessage(MessageConstants.MESSAGE_ACCELEROMETER_READING);
    Bundle b = m.getData();//from www  .j av  a  2  s  . c o m
    b.putFloat(MessageConstants.X_VALUE_KEY, (reading.getX() + 16) * DECIMAL_PRECISION);
    b.putFloat(MessageConstants.Y_VALUE_KEY, (reading.getY() + 16) * DECIMAL_PRECISION);
    b.putFloat(MessageConstants.Z_VALUE_KEY, (reading.getZ() + 16) * DECIMAL_PRECISION);

    //For this demo we are streaming all time stamp from the node device.
    b.putLong(MessageConstants.TIME_STAMP, reading.getTimeStamp().getTime());
    b.putInt(MessageConstants.TIME_SOURCE, reading.getTimeStampSource());

    final Context thiscontext = this.getActivity();
    final String serialnumOne = sensor.getSerialNumber();
    final String serialnum = serialnumOne.replaceAll("[^\\u0000-\\uFFFF]", "");
    final String scanX = Float.toString((reading.getX() + 16) * DECIMAL_PRECISION);
    final String scanY = Float.toString((reading.getY() + 16) * DECIMAL_PRECISION);
    final String scanZ = Float.toString((reading.getZ() + 16) * DECIMAL_PRECISION);
    String json = "accelerometer;" + serialnum + ";" + scanX + "," + scanY + "," + scanZ;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(
            "https://datadipity.com/clickslide/fleetplusdata.json?PHPSESSID=gae519f8k5humje0jqb195nob6&update&postparam[payload]="
                    + json)
            .setLogging("MyLogs", Log.DEBUG).asString().withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if (e == null) {
                        Log.i(TAG, "ION SENT MESSAGE WITH RESULT CODE: " + result.toString());
                    } else {
                        Log.i(TAG, "ION SENT MESSAGE WITH EXCEPTION");
                        e.printStackTrace();
                    }
                }
            });

    m.sendToTarget();
}

From source file:com.cerema.cloud2.lib.common.SingleSessionManager.java

@Override
public void saveAllClients(Context context, String accountType)
        throws AccountNotFoundException, AuthenticatorException, IOException, OperationCanceledException {

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "Saving sessions... ");
    }//from  www.j  a v  a2s.  c  om

    Iterator<String> accountNames = mClientsWithKnownUsername.keySet().iterator();
    String accountName = null;
    Account account = null;
    while (accountNames.hasNext()) {
        accountName = accountNames.next();
        account = new Account(accountName, accountType);
        AccountUtils.saveClient(mClientsWithKnownUsername.get(accountName), account, context);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "All sessions saved");
    }
}

From source file:com.samsung.spen.SpenPlugin.java

private void initContextDetails(CallbackContext callbackContext) {
    if (Log.isLoggable(Utils.SPEN, Log.DEBUG)) {
        Log.d(TAG, "Inside initContextDetails");
    }/* w  w  w .  j  a v a  2 s . c  o m*/
    if (mActivity == null) {
        mActivity = this.cordova.getActivity();
    }
    if (mContextParams == null) {
        mContextParams = new SpenContextParams();
        mContextParams.setSpenCustomDrawPlugin(this);
    }
    mContextParams.setCallbackContext(callbackContext);
}

From source file:de.madvertise.android.sdk.MadView.java

/**
 * Convenience method to notify the callback listener
 * @param succeed//from   w  w w .j a va2s  .c o m
 */
private void notifyListener(boolean succeed) {
    if (callbackListener != null) {
        callbackListener.onLoaded(succeed, this);
    } else {
        MadUtil.logMessage(null, Log.DEBUG, "Callback Listener not set");
    }
}

From source file:com.cbsb.ftpserv.ProxyConnector.java

public void run() {
    myLog.i("In ProxyConnector.run()");
    setProxyState(State.CONNECTING);
    try {//from   w w  w.j av  a 2s.c  o m
        String candidateProxies[] = getProxyList();
        for (String candidateHostname : candidateProxies) {
            hostname = candidateHostname;
            commandSocket = newAuthedSocket(hostname, Defaults.REMOTE_PROXY_PORT);
            if (commandSocket == null) {
                continue;
            }
            commandSocket.setSoTimeout(0); // 0 == forever
            //commandSocket.setKeepAlive(true);
            // Now that we have authenticated, we want to start the command session so we can
            // be notified of pending control sessions.
            JSONObject request = makeJsonRequest("start_command_session");
            response = sendRequest(commandSocket, request);
            if (response == null) {
                myLog.i("Couldn't create proxy command session");
                continue; // try next server
            }
            if (!response.has("prefix")) {
                myLog.l(Log.INFO, "start_command_session didn't receive a prefix in response");
                continue; // try next server
            }
            prefix = response.getString("prefix");
            response = null; // Indicate that response is free for other use
            myLog.l(Log.INFO, "Got prefix of: " + prefix);
            break; // breaking with commandSocket != null indicates success
        }
        if (commandSocket == null) {
            myLog.l(Log.INFO, "No proxies accepted connection, failing.");
            setProxyState(State.UNREACHABLE);
            return;
        }
        setProxyState(State.CONNECTED);
        preferServer(hostname);
        inputStream = commandSocket.getInputStream();
        out = commandSocket.getOutputStream();
        int numBytes;
        byte[] bytes = new byte[IN_BUF_SIZE];
        //spawnQuotaRequester().start();
        while (true) {
            myLog.d("to proxy read()");
            numBytes = inputStream.read(bytes);
            incrementProxyUsage(numBytes);
            myLog.d("from proxy read()");
            JSONObject incomingJson = null;
            if (numBytes > 0) {
                String responseString = new String(bytes, ENCODING);
                incomingJson = new JSONObject(responseString);
                if (incomingJson.has("action")) {
                    // If the incoming JSON object has an "action" field, then it is a
                    // request, and not a response
                    incomingCommand(incomingJson);
                } else {
                    // If the incoming JSON object does not have an "action" field, then
                    // it is a response to a request we sent earlier.
                    // If there's an object waiting for a response, then that object
                    // will be referenced by responseWaiter.
                    if (responseWaiter != null) {
                        if (response != null) {
                            myLog.l(Log.INFO, "Overwriting existing cmd session response");
                        }
                        response = incomingJson;
                        responseWaiter.interrupt();
                    } else {
                        myLog.l(Log.INFO, "Response received but no responseWaiter");
                    }
                }
            } else if (numBytes == 0) {
                myLog.d("Command socket read 0 bytes, looping");
            } else { // numBytes < 0
                myLog.l(Log.DEBUG, "Command socket end of stream, exiting");
                if (proxyState != State.DISCONNECTED) {
                    // Set state to FAILED unless this was an intentional
                    // socket closure.
                    setProxyState(State.FAILED);
                }
                break;
            }
        }
        myLog.l(Log.INFO, "ProxyConnector thread quitting cleanly");
    } catch (IOException e) {
        myLog.l(Log.INFO, "IOException in command session: " + e);
        setProxyState(State.FAILED);
    } catch (JSONException e) {
        myLog.l(Log.INFO, "Commmand socket JSONException: " + e);
        setProxyState(State.FAILED);
    } catch (Exception e) {
        myLog.l(Log.INFO, "Other exception in ProxyConnector: " + e);
        setProxyState(State.FAILED);
    } finally {
        Globals.setProxyConnector(null);
        hostname = null;
        myLog.d("ProxyConnector.run() returning");
        persistProxyUsage();
    }
}

From source file:com.dirkgassen.wator.ui.fragment.WatorDisplay.java

/**
 * Called when the {@link WorldHost} has updated its simulator. This method repaints the bitmap for the view.
 *
 * @param world {@link com.dirkgassen.wator.simulator.Simulator.WorldInspector} of the {@link Simulator} that was
 *              updated/*from   w  w  w. ja v  a2s  .  c  o m*/
 */
@Override
public void worldUpdated(Simulator.WorldInspector world) {
    if (Log.isLoggable("Wa-Tor", Log.VERBOSE)) {
        Log.v("Wa-Tor", "Updating image");
    }
    long startUpdate = System.currentTimeMillis();

    int worldWidth = world.getWorldWidth();
    int worldHeight = world.getWorldHeight();
    int fishBreedTime = world.getFishBreedTime();
    int sharkStarveTime = world.getSharkStarveTime();

    if (planetBitmap == null || planetBitmap.getWidth() != worldWidth
            || planetBitmap.getHeight() != worldHeight) {
        if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
            Log.d("Wa-Tor", "(Re)creating bitmap/pixels");
        }
        planetBitmap = Bitmap.createBitmap(worldWidth, worldHeight, Bitmap.Config.ARGB_8888);
        pixels = new int[worldWidth * worldHeight];
    }
    if (fishAgeColors == null || fishAgeColors.length != fishBreedTime) {
        if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
            Log.d("Wa-Tor", "(Re)creating fish colors");
        }
        fishAgeColors = calculateIndividualAgeColors(fishBreedTime,
                ContextCompat.getColor(getContext(), R.color.fish_young),
                ContextCompat.getColor(getContext(), R.color.fish_old));
    }
    if (sharkAgeColors == null || sharkAgeColors.length != sharkStarveTime) {
        if (Log.isLoggable("Wa-Tor", Log.DEBUG)) {
            Log.d("Wa-Tor", "(Re)creating shark colors");
        }
        sharkAgeColors = calculateIndividualAgeColors(sharkStarveTime,
                ContextCompat.getColor(getContext(), R.color.shark_young),
                ContextCompat.getColor(getContext(), R.color.shark_old));
    }

    do {
        if (world.isEmpty()) {
            pixels[world.getCurrentPosition()] = waterColor;
        } else if (world.isFish()) {
            pixels[world.getCurrentPosition()] = fishAgeColors[world.getFishAge() - 1];
        } else {
            pixels[world.getCurrentPosition()] = sharkAgeColors[world.getSharkHunger() - 1];
        }
    } while (world.moveToNext() != Simulator.WorldInspector.RESET);
    if (Log.isLoggable("Wa-Tor", Log.VERBOSE)) {
        Log.v("Wa-Tor", "Generating pixels " + (System.currentTimeMillis() - startUpdate) + " ms");
    }
    synchronized (WatorDisplay.this) {
        if (planetBitmap != null) {
            int width = planetBitmap.getWidth();
            int height = planetBitmap.getHeight();
            planetBitmap.setPixels(pixels, 0, width, 0, 0, width, height);
        }
    }
    handler.post(updateImageRunner);
    if (Log.isLoggable("Wa-Tor", Log.VERBOSE)) {
        Log.v("Wa-Tor", "Repainting took " + (System.currentTimeMillis() - startUpdate) + " ms");
    }
}

From source file:org.rti.rcd.ict.lgug.C2DMReceiver.java

protected void onReceive(Context context, Intent intent) {
    String accountName = intent.getExtras().getString(Config.C2DM_ACCOUNT_EXTRA);
    String message = intent.getExtras().getString(Config.C2DM_MESSAGE_EXTRA);
    if (Config.C2DM_MESSAGE_SYNC.equals(message)) {
        if (accountName != null) {
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Messaging request received for account " + accountName);
            }/*ww  w .j a  v a  2  s . com*/

            //                ContentResolver.requestSync(
            //                    new Account(accountName, SyncAdapter.GOOGLE_ACCOUNT_TYPE),
            //                    JumpNoteContract.AUTHORITY, new Bundle());
        }
    }
}

From source file:com.radicaldynamic.groupinform.services.InformOnlineService.java

public void reinitializeService() {
    if (Collect.Log.DEBUG)
        Log.d(Collect.LOGTAG, t + "service reinitialized");

    mInitialized = mServicePingSuccessful = mSignedIn = false;
}

From source file:com.example.android.wearable.agendadata.MainActivity.java

public void onDeleteEventsClicked(View view) {
    if (mGoogleApiClient.isConnected()) {
        Wearable.DataApi.getDataItems(mGoogleApiClient).setResultCallback(new ResultCallback<DataItemBuffer>() {
            @Override/*  w  ww .jav  a  2s  . c o m*/
            public void onResult(DataItemBuffer result) {
                try {
                    if (result.getStatus().isSuccess()) {
                        deleteDataItems(result);
                    } else {
                        if (Log.isLoggable(TAG, Log.DEBUG)) {
                            Log.d(TAG, "onDeleteEventsClicked(): failed to get Data " + "Items");
                        }
                    }
                } finally {
                    result.release();
                }
            }
        });
    } else {
        Log.e(TAG, "Failed to delete data items" + " - Client disconnected from Google Play Services");
    }
}

From source file:com.variable.demo.api.fragment.ClimaFragment.java

@Override
public void onClimaPressureUpdate(ClimaSensor clima, SensorReading<Integer> kPa) {
    Message m = mHandler.obtainMessage(MessageConstants.MESSAGE_CLIMA_PRESSURE);
    m.getData().putFloat(MessageConstants.FLOAT_VALUE_KEY, kPa.getValue());
    // convert the UTF
    final Context thiscontext = this.getActivity();
    final DecimalFormat formatter = new DecimalFormat("0.00");
    final String serialnumOne = clima.getSerialNumber();
    final String serialnum = serialnumOne.replaceAll("[^\\u0000-\\uFFFF]", "");
    final String scann = formatter.format(kPa.getValue());
    String json = "pressure;" + serialnum + ";" + scann;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(//from   w w w .  j  a  va 2s .  c  o  m
            "https://datadipity.com/clickslide/fleetplusdata.json?PHPSESSID=gae519f8k5humje0jqb195nob6&update&postparam[payload]="
                    + json)
            .setLogging("MyLogs", Log.DEBUG).asString().withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if (e == null) {
                        Log.i(TAG, "ION SENT MESSAGE WITH RESULT CODE: " + result.toString());
                    } else {
                        Log.i(TAG, "ION SENT MESSAGE WITH EXCEPTION");
                        e.printStackTrace();
                    }
                }
            });
    m.sendToTarget();
}