Example usage for android.util Log wtf

List of usage examples for android.util Log wtf

Introduction

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

Prototype

public static int wtf(String tag, Throwable tr) 

Source Link

Document

What a Terrible Failure: Report an exception that should never happen.

Usage

From source file:com.javadog.cgeowear.cgeoWear.java

@Override
public void onConnected(Bundle bundle) {
    //As soon as the Google APIs are connected, grab the connected Node ID
    new Thread(new Runnable() {
        @Override//from w w w .  j av a  2s  . c  o m
        public void run() {
            HashSet<String> connectedWearDevices = new HashSet<String>();
            NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(apiClient).await();
            for (Node node : nodes.getNodes()) {
                connectedWearDevices.add(node.getId());
            }

            try {
                connectedNodeId = connectedWearDevices.iterator().next();
            } catch (NoSuchElementException e) {
                Log.wtf(DEBUG_TAG, "No paired devices found.");
                connectedNodeId = null;
            }
        }
    }).start();
}

From source file:com.justinbull.ichnaeachecker.MainActivity.java

public void setCellInfo() {
    int tmPermCheck = ContextCompat.checkSelfPermission(MainActivity.this,
            android.Manifest.permission.ACCESS_COARSE_LOCATION);
    if (tmPermCheck == PackageManager.PERMISSION_GRANTED) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1
                && tm.getAllCellInfo() != null) {
            mVisibleCells = GeneralCellInfoFactory.getInstances(tm.getAllCellInfo());
            // Sort cells by strength
            Collections.sort(mVisibleCells, new Comparator<GeneralCellInfo>() {
                @Override/*from w w w. ja  v  a  2 s  . c  om*/
                public int compare(GeneralCellInfo lhs, GeneralCellInfo rhs) {
                    int lhsDbm = lhs.getAsuStrength();
                    int rhsDbm = rhs.getAsuStrength();
                    if (lhsDbm == rhsDbm) {
                        return 0;
                    }
                    return lhsDbm > rhsDbm ? -1 : 1;
                }
            });
            mRegisteredCells.clear();
            if (mVisibleCells.size() == 0) {
                Log.w(TAG, "setCellInfo: No visible cells (primary or neighbours), unable to do anything");
            }
            for (GeneralCellInfo cell : mVisibleCells) {
                Log.i(TAG, "Device aware of " + cell.toString());
                if (cell.isRegistered()) {
                    mRegisteredCells.add(cell);
                }
            }
            if (mRegisteredCells.isEmpty()) {
                Log.w(TAG, "setCellInfo: No registered cells, nothing to select.");
                mSelectedCell = null;
            } else {
                Log.i(TAG, "setCellInfo: Preselected strongest registered cell: " + mRegisteredCells.get(0));
                mSelectedCell = mRegisteredCells.get(0);
            }
        } else {
            Log.e(TAG,
                    "setCellInfo: Android device too old to use getAllCellInfo(), need to implement getCellLocation() fallback!");
        }
        mCellListAdapter = new ArrayAdapter<GeneralCellInfo>(this, android.R.layout.simple_list_item_1,
                mVisibleCells);
    } else if (tmPermCheck == PackageManager.PERMISSION_DENIED) {
        if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
                android.Manifest.permission.ACCESS_COARSE_LOCATION)) {
            Toast.makeText(MainActivity.this, "Dude we need permissions", Toast.LENGTH_LONG).show();
        }
        ActivityCompat.requestPermissions(MainActivity.this,
                new String[] { android.Manifest.permission.ACCESS_COARSE_LOCATION },
                Consts.REQUEST_COARSE_LOCATION);
    } else {
        Log.wtf(TAG, "setCellInfo: Received unknown int from ContextCompat.checkSelfPermission()");
    }
}

From source file:at.bitfire.davdroid.mirakel.resource.Contact.java

@Override
public ByteArrayOutputStream toEntity() throws IOException {
    VCard vcard = null;/*  w  ww . java2  s .  c  o  m*/
    try {
        if (unknownProperties != null)
            vcard = Ezvcard.parse(unknownProperties).first();
    } catch (Exception e) {
        Log.w(TAG, "Couldn't parse original property set, beginning from scratch");
    }
    if (vcard == null)
        vcard = new VCard();

    if (uid != null)
        vcard.setUid(new Uid(uid));
    else
        Log.wtf(TAG, "Generating VCard without UID");

    if (starred)
        vcard.setExtendedProperty(PROPERTY_STARRED, "1");

    if (displayName != null)
        vcard.setFormattedName(displayName);
    else if (organization != null && organization.getValues() != null
            && organization.getValues().get(0) != null)
        vcard.setFormattedName(organization.getValues().get(0));
    else
        Log.w(TAG, "No FN (formatted name) available to generate VCard");

    // N
    if (familyName != null || middleName != null || givenName != null) {
        StructuredName n = new StructuredName();
        if (prefix != null)
            for (String p : StringUtils.split(prefix))
                n.addPrefix(p);
        n.setGiven(givenName);
        if (middleName != null)
            for (String middle : StringUtils.split(middleName))
                n.addAdditional(middle);
        n.setFamily(familyName);
        if (suffix != null)
            for (String s : StringUtils.split(suffix))
                n.addSuffix(s);
        vcard.setStructuredName(n);
    }

    // phonetic names
    if (phoneticGivenName != null)
        vcard.addExtendedProperty(PROPERTY_PHONETIC_FIRST_NAME, phoneticGivenName);
    if (phoneticMiddleName != null)
        vcard.addExtendedProperty(PROPERTY_PHONETIC_MIDDLE_NAME, phoneticMiddleName);
    if (phoneticFamilyName != null)
        vcard.addExtendedProperty(PROPERTY_PHONETIC_LAST_NAME, phoneticFamilyName);

    // TEL
    for (Telephone phoneNumber : phoneNumbers)
        vcard.addTelephoneNumber(phoneNumber);

    // EMAIL
    for (Email email : emails)
        vcard.addEmail(email);

    // ORG, TITLE, ROLE
    if (organization != null)
        vcard.setOrganization(organization);
    if (jobTitle != null)
        vcard.addTitle(jobTitle);
    if (jobDescription != null)
        vcard.addRole(jobDescription);

    // IMPP
    for (Impp impp : impps)
        vcard.addImpp(impp);

    // NICKNAME
    if (!StringUtils.isBlank(nickName))
        vcard.setNickname(nickName);

    // NOTE
    if (!StringUtils.isBlank(note))
        vcard.addNote(note);

    // ADR
    for (Address address : addresses)
        vcard.addAddress(address);

    // CATEGORY
    if (!categories.isEmpty())
        vcard.setCategories(categories.toArray(new String[0]));

    // URL
    for (String url : URLs)
        vcard.addUrl(url);

    // ANNIVERSARY
    if (anniversary != null)
        vcard.setAnniversary(anniversary);
    // BDAY
    if (birthDay != null)
        vcard.setBirthday(birthDay);

    // PHOTO
    if (photo != null)
        vcard.addPhoto(new Photo(photo, ImageType.JPEG));

    // PRODID, REV
    vcard.setProductId("DAVdroid/" + Constants.APP_VERSION + " (ez-vcard/" + Ezvcard.VERSION + ")");
    vcard.setRevision(Revision.now());

    // validate and print warnings
    ValidationWarnings warnings = vcard.validate(VCardVersion.V3_0);
    if (!warnings.isEmpty())
        Log.w(TAG, "Created potentially invalid VCard! " + warnings);

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    Ezvcard.write(vcard).version(VCardVersion.V3_0).versionStrict(false).prodId(false) // we provide our own PRODID
            .go(os);
    return os;
}

From source file:com.javadog.cgeowear.cgeoWearService.java

@Override
public void onConnected(Bundle bundle) {
    //As soon as the Google APIs are connected, grab the connected Node ID
    new Thread(new Runnable() {
        @Override/*w  w  w  .ja v  a  2  s . com*/
        public void run() {
            HashSet<String> connectedWearDevices = new HashSet<>();
            NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(apiClient).await();
            for (Node node : nodes.getNodes()) {
                connectedWearDevices.add(node.getId());
            }

            try {
                connectedNodeId = connectedWearDevices.iterator().next();
            } catch (NoSuchElementException e) {
                Log.wtf(DEBUG_TAG, "No paired devices found.");
                connectedNodeId = null;
            }
        }
    }).start();
}

From source file:com.roymam.android.nilsplus.ui.NiLSActivity.java

public static int getCurrentVersion(Context context) {
    // get current version
    try {//from   w ww . j  a v a 2 s  .  com
        return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        Log.wtf("NiLS", "cannot find version number");
        e.printStackTrace();
        return 0;
    }
}

From source file:com.eveningoutpost.dexdrip.Home.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    mActivity = this;

    if (!xdrip.checkAppContext(getApplicationContext())) {
        toast("Unusual internal context problem - please report");
        Log.wtf(TAG, "xdrip.checkAppContext FAILED!");
        try {/*from ww w . j  a v a 2 s  .  com*/
            xdrip.initCrashlytics(getApplicationContext());
            Crashlytics.log("xdrip.checkAppContext FAILED!");
        } catch (Exception e) {
            // nothing we can do really
        }
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // not much to do
        }
        if (!xdrip.checkAppContext(getApplicationContext())) {
            toast("Cannot start - please report context problem");
            finish();
        }
    }
    xdrip.checkForcedEnglish(Home.this);
    menu_name = getString(R.string.home_screen);

    super.onCreate(savedInstanceState);
    setTheme(R.style.AppThemeToolBarLite); // for toolbar mode

    set_is_follower();

    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    final boolean checkedeula = checkEula();

    //if (Build.VERSION.SDK_INT >= 21) {
    //    getWindow().setNavigationBarColor(Color.BLUE);
    //    getWindow().setStatusBarColor(getCol(X.color_home_chart_background));
    //}
    setContentView(R.layout.activity_home);

    Toolbar mToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(mToolbar);

    //findViewById(R.id.home_layout_holder).setBackgroundColor(getCol(X.color_home_chart_background));
    this.dexbridgeBattery = (TextView) findViewById(R.id.textBridgeBattery);
    this.parakeetBattery = (TextView) findViewById(R.id.parakeetbattery);
    this.sensorAge = (TextView) findViewById(R.id.libstatus);
    this.extraStatusLineText = (TextView) findViewById(R.id.extraStatusLine);
    this.currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime);

    extraStatusLineText.setText("");
    dexbridgeBattery.setText("");
    parakeetBattery.setText("");
    sensorAge.setText("");

    if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        this.currentBgValueText.setTextSize(100);
    }
    this.notificationText = (TextView) findViewById(R.id.notices);
    if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        this.notificationText.setTextSize(40);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Intent intent = new Intent();
        String packageName = getPackageName();
        Log.d(TAG, "Maybe ignoring battery optimization");
        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        if (!pm.isIgnoringBatteryOptimizations(packageName)
                && !prefs.getBoolean("requested_ignore_battery_optimizations_new", false)) {
            Log.d(TAG, "Requesting ignore battery optimization");
            // prefs.edit().putBoolean("requested_ignore_battery_optimizations", true).apply();
            intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
            intent.setData(Uri.parse("package:" + packageName));
            startActivity(intent);
            JoH.static_toast_long("Select YES for best performance!");
        }
    }

    // jamorham voice input et al
    this.voiceRecognitionText = (TextView) findViewById(R.id.treatmentTextView);
    this.textBloodGlucose = (TextView) findViewById(R.id.textBloodGlucose);
    this.textCarbohydrates = (TextView) findViewById(R.id.textCarbohydrate);
    this.textInsulinDose = (TextView) findViewById(R.id.textInsulinUnits);
    this.textTime = (TextView) findViewById(R.id.textTimeButton);
    this.btnBloodGlucose = (ImageButton) findViewById(R.id.bloodTestButton);
    this.btnCarbohydrates = (ImageButton) findViewById(R.id.buttonCarbs);
    this.btnInsulinDose = (ImageButton) findViewById(R.id.buttonInsulin);
    this.btnCancel = (ImageButton) findViewById(R.id.cancelTreatment);
    this.btnApprove = (ImageButton) findViewById(R.id.approveTreatment);
    this.btnTime = (ImageButton) findViewById(R.id.timeButton);
    this.btnUndo = (ImageButton) findViewById(R.id.btnUndo);
    this.btnRedo = (ImageButton) findViewById(R.id.btnRedo);
    this.btnVehicleMode = (ImageButton) findViewById(R.id.vehicleModeButton);

    hideAllTreatmentButtons();

    if (searchWords == null) {
        initializeSearchWords("");
    }

    this.btnSpeak = (ImageButton) findViewById(R.id.btnTreatment);
    btnSpeak.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            promptTextInput();

        }
    });
    btnSpeak.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            promptSpeechInput();
            return true;
        }
    });

    this.btnNote = (ImageButton) findViewById(R.id.btnNote);
    btnNote.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            if (Home.getPreferencesBooleanDefaultFalse("default_to_voice_notes")) {
                showNoteTextInputDialog(v, 0);
            } else {
                promptSpeechNoteInput(v);
            }
            return false;
        }
    });
    btnNote.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!Home.getPreferencesBooleanDefaultFalse("default_to_voice_notes")) {
                showNoteTextInputDialog(v, 0);
            } else {
                promptSpeechNoteInput(v);
            }
        }
    });

    btnCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            cancelTreatment();
        }
    });

    btnApprove.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            processAndApproveTreatment();
        }
    });

    btnInsulinDose.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // proccess and approve treatment
            textInsulinDose.setVisibility(View.INVISIBLE);
            btnInsulinDose.setVisibility(View.INVISIBLE);
            Treatments.create(0, thisinsulinnumber, Treatments.getTimeStampWithOffset(thistimeoffset));
            reset_viewport = true;
            if (hideTreatmentButtonsIfAllDone()) {
                updateCurrentBgInfo("insulin button");
            }
        }
    });
    btnCarbohydrates.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // proccess and approve treatment
            textCarbohydrates.setVisibility(View.INVISIBLE);
            btnCarbohydrates.setVisibility(View.INVISIBLE);
            reset_viewport = true;
            Treatments.create(thiscarbsnumber, 0, Treatments.getTimeStampWithOffset(thistimeoffset));
            if (hideTreatmentButtonsIfAllDone()) {
                updateCurrentBgInfo("carbs button");
            }
        }
    });

    btnBloodGlucose.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            reset_viewport = true;
            processCalibration();
        }
    });

    btnTime.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // clears time if clicked
            textTime.setVisibility(View.INVISIBLE);
            btnTime.setVisibility(View.INVISIBLE);
            if (hideTreatmentButtonsIfAllDone()) {
                updateCurrentBgInfo("time button");
            }
        }
    });

    final DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screen_width = dm.widthPixels;
    int screen_height = dm.heightPixels;

    if (screen_width <= 320) {
        small_width = true;
        small_screen = true;
    }
    if (screen_height <= 320) {
        small_height = true;
        small_screen = true;
    }
    final int refdpi = 320;
    Log.d(TAG, "Width height: " + screen_width + " " + screen_height + " DPI:" + dm.densityDpi);

    JoH.fixActionBar(this);
    try {
        getSupportActionBar().setTitle(R.string.app_name);
    } catch (NullPointerException e) {
        Log.e(TAG, "Couldn't set title due to null pointer");
    }
    activityVisible = true;

    // handle incoming extras
    Bundle bundle = getIntent().getExtras();
    processIncomingBundle(bundle);

    checkBadSettings();

    // lower priority
    PlusSyncService.startSyncService(getApplicationContext(), "HomeOnCreate");
    ParakeetHelper.notifyOnNextCheckin(false);

    if ((checkedeula) && (!getString(R.string.app_name).equals("xDrip+"))) {
        showcasemenu(SHOWCASE_VARIANT);
    }

}

From source file:com.silentcircle.accounts.AccountStep3.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.back: {
        InputMethodManager imm = (InputMethodManager) mParent.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
        mParent.backStep();//from  w w  w  .ja  v a  2  s . co m
        break;
    }
    case R.id.create: {
        createAccount();
        break;
    }
    case R.id.license_next: {
        if (mLicenseErrorCode == 1) {
            mParent.provisioningCancel();
            return;
        }
        if (mLicenseErrorCode == 2) { // feature (Ronin) code in use, ask for existing account info
            mParent.clearBackStack();
            mParent.accountStep2();
        }
        break;
    }
    default: {
        Log.wtf(TAG, "Unexpected onClick() event from: " + view);
        break;
    }
    }
}

From source file:org.odk.collect.android.application.Collect.java

public void beginGetSurveys(Context ctx) {
    Ctx = ctx;//  w ww.  j av  a  2  s. c o  m

    try {
        MobileServiceClient client = new MobileServiceClient("https://flikkodk.azure-mobile.net/",
                "SenCBSjDhFGTRqbwhDMiKKZJSxBhGK39", Ctx);

        PropertyManager manager = new PropertyManager(this);
        String userName = manager.getSingularProperty("username");
        String userNameSpaced = userName.replace('_', ' ');

        client.getTable("Survey").where().field("Completed").eq(false).and().field("surveyorname")
                .eq(userNameSpaced).execute(new TableJsonQueryCallback() {
                    @Override
                    public void onCompleted(JsonElement result, int count, Exception exception,
                            ServiceFilterResponse response) {
                        if (exception == null) {
                            Log.d("Azure", result.toString());
                            JsonArray res = (JsonArray) result;
                            Surveys = new JsonArray();
                            for (JsonElement e : res) {
                                try {
                                    JsonObject o = (JsonObject) e;
                                    if (e != null) {
                                        JsonElement address1 = o.get("address1");
                                        if (address1.isJsonNull()) {
                                        } else if (address1.getAsString().length() == 0) {
                                        } else {
                                            Surveys.add(e);
                                        }
                                    }
                                } catch (Exception ex) {
                                }
                            }
                            sendBroadcast(SurveysUpdatedKey);
                        } else {
                            Log.wtf("Azure", exception.getMessage());
                            //receivedMessage = exception.getMessage();
                        }
                    }
                });

    } catch (MalformedURLException e) {

    }

}

From source file:io.jari.geenstijl.API.API.java

public static boolean logIn(String email, String password, Context context)
        throws IOException, URISyntaxException {
    ensureCookies();/*from   ww w .  j av a  2s . c o  m*/
    //add params
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("t", "666"));
    params.add(new BasicNameValuePair("_mode", "handle_sign_in"));
    params.add(new BasicNameValuePair("_return",
            "http%3A%2F%2Fapp.steylloos.nl%2Fmt-comments.fcgi%3F__mode%3Dhandle_sign_in%26entry_id%3D3761581%26static%3Dhttp%3A%2F%2Fwww.steylloos.nl%2Fcookiesync.php%3Fsite%3DGSNL%2526return%3DaHR0cDovL3d3dy5nZWVuc3RpamwubmwvcmVhZGVyLWxvZ2dlZGlu"));
    params.add(new BasicNameValuePair("email", email));
    params.add(new BasicNameValuePair("password", password));

    String res = postUrl("http://registratie.geenstijl.nl/registratie/gs_engine.php?action=login", params, null,
            false);
    if (res.contains("font color=\"red\""))
        return false;
    else {
        List<HttpCookie> cookies = cookieManager.getCookieStore().get(new URI("http://app.steylloos.nl"));
        String commenter_name = null;
        String tk_commenter = null;
        for (HttpCookie cookie : cookies) {
            if (cookie.getName().equals("tk_commenter"))
                tk_commenter = cookie.getValue();
            else if (cookie.getName().equals("commenter_name"))
                commenter_name = cookie.getValue();
        }
        //sanity check
        if (commenter_name == null || tk_commenter == null) {
            Log.wtf(TAG,
                    "Ermmm, wut? GeenStijl redirected us to the correct URL but hasn't passed us the correct cookies?");
            return false;
        }

        String cheader = String.format("commenter_name=%s; tk_commenter=%s;", commenter_name, tk_commenter);
        Log.d(TAG, "Login completed, debug data:\ncookieheader: " + cheader);
        context.getSharedPreferences("geenstijl", 0).edit().putString("username", commenter_name).commit();
        setSession(cheader, context);
        return true;
    }
}

From source file:key.secretkey.crypto.PgpHandler.java

public void handleClick(View view) {
    switch (view.getId()) {
    case R.id.crypto_show_button:
        decryptAndVerify(new Intent());
        break;//from   w  w  w  .  ja  v  a2  s  . c om
    case R.id.crypto_delete_button:
        //                deletePassword();
        break;
    case R.id.crypto_get_key_ids:
        getKeyIds(new Intent());
        break;
    case R.id.generate_password:
        DialogFragment df = new passwordGenerationFragment();
        df.show(getFragmentManager(), "generator");
    default:
        Log.wtf(Constants.TAG, "This should not happen.... PgpHandler.java#handleClick(View) default reached.");
        // should not happen

    }
}