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.abajeli.wearable.gesturecadabra.MainActivity.java

/**
 * This will save battery//w  w w .  java 2  s . com
 */
@Override
protected void onPause() {
    super.onPause();
    mSensorManager.unregisterListener(this);
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Unregistered for sensor events");
    }
}

From source file:edu.berkeley.boinc.client.NoticeNotification.java

private static final Bitmap getLargeProjectIcon(final Context context, final String projectName) {
    final Bitmap projectIconBitmap;
    try {/*w w  w .j a v  a2s . com*/
        return (projectIconBitmap = Monitor.getClientStatus().getProjectIconByName(projectName)) != null
                ? Bitmap.createScaledBitmap(projectIconBitmap, projectIconBitmap.getWidth() << 1,
                        projectIconBitmap.getHeight() << 1, false)
                : BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_stat_notify_boinc_normal);
    } catch (Exception e) {
        if (Log.isLoggable(Logging.TAG, Log.DEBUG)) {
            Log.d(Logging.TAG, e.getLocalizedMessage(), e);
        }
        return BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_stat_notify_boinc_normal);
    }
}

From source file:com.popdeem.sdk.core.PopdeemSDK.java

/**
 * Initialize Popdeem SDK/*from w w  w . j a va2 s  .  com*/
 *
 * @param application Application context
 * @param enviroment Popdeem enviroment PD_PROD_API_ENDPOINT, PD_STAGING_API_ENDPOINT
 *
 */
public static void initializeSDK(@NonNull final Application application, String enviroment) {

    application.registerReceiver(mLoggedInBroadcastReceiver, new IntentFilter(PD_LOGGED_IN_RECEIVER_FILTER));

    PDAPIConfig.PD_API_ENDPOINT = enviroment;
    sApplication = application;

    // Register Activity Lifecycle Callbacks
    application.registerActivityLifecycleCallbacks(PD_ACTIVITY_LIFECYCLE_CALLBACKS);

    // Init Realm
    PDRealmUtils.initRealmDB(application);

    TwitterAuthConfig authConfig = PDSocialUtils.getTwitterAuthConfig(application.getApplicationContext());

    TwitterConfig config = new TwitterConfig.Builder(application).logger(new DefaultLogger(Log.DEBUG))
            .twitterAuthConfig(authConfig).debug(true).build();
    Twitter.initialize(config);

    // Get Popdeem API Key
    getPopdeemAPIKey();
    FacebookSdk.sdkInitialize(application, new FacebookSdk.InitializeCallback() {
        @Override
        public void onInitialized() {
            Log.i("Facebook", "onInitialized: Facebook initialized");
        }
    });

    sdkInitialized = true;

    PDAPIClient.instance().getCustomer(new PDAPICallback<JsonObject>() {
        @Override
        public void success(JsonObject jsonObject) {
            Log.i("JsonObject", "success: ");
            if (jsonObject.has("customer")) {
                JsonObject customer = jsonObject.getAsJsonObject("customer");
                PDRealmCustomer realmCustomer = PDRealmCustomer.fromJson(customer);

                Realm realm = Realm.getDefaultInstance();
                realm.beginTransaction();
                RealmResults<PDRealmCustomer> results = realm.where(PDRealmCustomer.class).findAll();
                results.deleteAllFromRealm();
                realm.copyToRealm(realmCustomer);
                realm.commitTransaction();
                realm.close();
                initFromCustomer(application);

            }
        }

        @Override
        public void failure(int statusCode, Exception e) {
            e.printStackTrace();
            initFromCustomer(application);

        }
    });

    // Get UID for Non Social login
    if (PDUniqueIdentifierUtils.getUID() == null) {
        PDUniqueIdentifierUtils.createUID(application, new PDUniqueIdentifierUtils.PDUIDCallback() {
            @Override
            public void success(String uid) {
                PDRealmNonSocialUID uidReam = new PDRealmNonSocialUID();
                //                    uidReam.setId(0);
                uidReam.setRegistered(false);
                uidReam.setUid(uid);

                Realm realm = Realm.getDefaultInstance();
                realm.beginTransaction();
                realm.copyToRealmOrUpdate(uidReam);
                realm.commitTransaction();
                realm.close();

                registerNonSocialUser();
            }

            @Override
            public void failure(String message) {
                PDLog.d(PDUniqueIdentifierUtils.class, "failed to create uid: " + message);
            }
        });
    }

    // Init GCM
    PDFirebaseMessagingService.initGCM(application, new PDGCMUtils.PDGCMRegistrationCallback() {
        @Override
        public void success(String registrationToken) {
            PDLog.d(PDGCMUtils.class, "Init GCM success. Registration token: " + registrationToken);
            registerNonSocialUser();
        }

        @Override
        public void failure(String message) {
            PDLog.d(PDGCMUtils.class, "Init GCM failure: " + message);
        }
    });

}

From source file:de.vanita5.twittnuker.util.net.ssl.HostResolvedSSLConnectionSocketFactory.java

@Override
public Socket createLayeredSocket(final Socket socket, final String target, final int port,
        final HttpContext context) throws IOException {
    final SSLSocket sslsock = (SSLSocket) socketfactory.createSocket(socket, target, port, true);
    if (supportedProtocols != null) {
        sslsock.setEnabledProtocols(supportedProtocols);
    }//from ww w.j ava 2  s . c  om
    if (supportedCipherSuites != null) {
        sslsock.setEnabledCipherSuites(supportedCipherSuites);
    }
    prepareSocket(sslsock);

    // Android specific code to enable SNI
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {

        if (socketfactory instanceof SSLCertificateSocketFactory) {
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Enabling SNI for " + target);
            }
            ((SSLCertificateSocketFactory) socketfactory).setHostname(sslsock, target);
        }
    }
    // End of Android specific code

    sslsock.startHandshake();
    verifyHostname(sslsock, target, context);
    return sslsock;
}

From source file:ir.keloud.android.lib.common.SingleSessionManager.java

@Override
public KeloudClient removeClientFor(KeloudAccount account) {

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "removeClientFor starting ");
    }//from  w  w  w. j av  a2s . c o  m

    if (account == null) {
        return null;
    }

    KeloudClient client = null;
    String accountName = account.getName();
    if (accountName != null) {
        client = mClientsWithKnownUsername.remove(accountName);
        if (client != null) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log_OC.v(TAG, "Removed client for account " + accountName);
            }
            return client;
        } else {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log_OC.v(TAG, "No client tracked for  account " + accountName);
            }
        }
    }

    mClientsWithUnknownUsername.clear();

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "removeClientFor finishing ");
    }
    return null;

}

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

@Override
public OwnCloudClient removeClientFor(OwnCloudAccount account) {

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "removeClientFor starting ");
    }//w ww  .  ja v  a2s.co  m

    if (account == null) {
        return null;
    }

    OwnCloudClient client = null;
    String accountName = account.getName();
    if (accountName != null) {
        client = mClientsWithKnownUsername.remove(accountName);
        if (client != null) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log_OC.v(TAG, "Removed client for account " + accountName);
            }
            return client;
        } else {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log_OC.v(TAG, "No client tracked for  account " + accountName);
            }
        }
    }

    mClientsWithUnknownUsername.clear();

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "removeClientFor finishing ");
    }
    return null;

}

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

@Override
public void onTemperatureReading(ThermaSensor sensor, SensorReading<Float> reading) {
    Message m = mHandler.obtainMessage(MessageConstants.MESSAGE_THERMA_TEMPERATURE);
    m.getData().putFloat(MessageConstants.FLOAT_VALUE_KEY, reading.getValue());

    final Context thiscontext = this.getActivity();
    final String serialnumOne = sensor.getSerialNumber();
    final String serialnum = serialnumOne.replaceAll("[^\\u0000-\\uFFFF]", "");
    final String scan = Float.toString(reading.getValue());
    String json = "temperature;" + serialnum + ";" + scan;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(/*w  ww  .j  a v  a2  s .  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();

}

From source file:com.android.switchaccess.SwitchAccessService.java

@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
    LogUtils.log(this, Log.DEBUG, "A shared preference changed: %s", key);
    mKeyboardEventManager.reloadPreferences(this);
}

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

@Override
public void onClimaLightUpdate(ClimaSensor clima, SensorReading<Float> lightLevel) {
    Message m = mHandler.obtainMessage(MessageConstants.MESSAGE_CLIMA_LIGHT);
    m.getData().putFloat(MessageConstants.FLOAT_VALUE_KEY, lightLevel.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(lightLevel.getValue());
    String json = "light;" + serialnum + ";" + scann;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(/*ww  w. ja va2s.  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();
}

From source file:net.micode.fileexplorer.ServerControlActivity.java

/**
 * This will be called by the static UiUpdater whenever the service has
 * changed state in a way that requires us to update our UI. We can't use
 * any myLog.l() calls in this function, because that will trigger an
 * endless loop of UI updates./*  w w w. j  a  v  a 2 s .  com*/
 */
public void updateUi() {
    myLog.l(Log.DEBUG, "Updating UI", true);

    WifiManager wifiMgr = (WifiManager) mActivity.getSystemService(Context.WIFI_SERVICE);
    int wifiState = wifiMgr.getWifiState();
    WifiInfo info = wifiMgr.getConnectionInfo();
    String wifiId = info != null ? info.getSSID() : null;
    boolean isWifiReady = FTPServerService.isWifiEnabled();

    setText(R.id.wifi_state, isWifiReady ? wifiId : getString(R.string.no_wifi_hint));
    ImageView wifiImg = (ImageView) mRootView.findViewById(R.id.wifi_state_image);
    wifiImg.setImageResource(isWifiReady ? R.drawable.wifi_state4 : R.drawable.wifi_state0);

    boolean running = FTPServerService.isRunning();
    if (running) {
        myLog.l(Log.DEBUG, "updateUi: server is running", true);
        // Put correct text in start/stop button
        // Fill in wifi status and address
        InetAddress address = FTPServerService.getWifiIp();
        if (address != null) {
            String port = ":" + FTPServerService.getPort();
            ipText.setText(
                    "ftp://" + address.getHostAddress() + (FTPServerService.getPort() == 21 ? "" : port));

        } else {
            // could not get IP address, stop the service
            Context context = mActivity.getApplicationContext();
            Intent intent = new Intent(context, FTPServerService.class);
            context.stopService(intent);
            ipText.setText("");
        }
    }

    startStopButton.setEnabled(isWifiReady);
    TextView startStopButtonText = (TextView) mRootView.findViewById(R.id.start_stop_button_text);
    if (isWifiReady) {
        startStopButtonText.setText(running ? R.string.stop_server : R.string.start_server);
        startStopButtonText.setCompoundDrawablesWithIntrinsicBounds(
                running ? R.drawable.disconnect : R.drawable.connect, 0, 0, 0);
        startStopButtonText.setTextColor(running ? getResources().getColor(R.color.remote_disconnect_text)
                : getResources().getColor(R.color.remote_connect_text));
    } else {
        if (FTPServerService.isRunning()) {
            Context context = mActivity.getApplicationContext();
            Intent intent = new Intent(context, FTPServerService.class);
            context.stopService(intent);
        }

        startStopButtonText.setText(R.string.no_wifi);
        startStopButtonText.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        startStopButtonText.setTextColor(Color.GRAY);
    }

    ipText.setVisibility(running ? View.VISIBLE : View.INVISIBLE);
    instructionText.setVisibility(running ? View.VISIBLE : View.GONE);
    instructionTextPre.setVisibility(running ? View.GONE : View.VISIBLE);
}