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, String msg, Throwable tr) 

Source Link

Document

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

Usage

From source file:edu.umich.oasis.testapp.TestActivity.java

public void pushECU(View ignored) {
    try {/* w ww.  ja v a 2  s. c o m*/
        setButtonsEnabled(false);

        if (pushECUSoda == null) {
            pushECUSoda = connection.resolveStatic(void.class, GMTest.class, "pushValue");
        }

        pushECUSoda.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in pushECU()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:edu.umich.flowfence.testapp.TestActivity.java

public void pushECU(View ignored) {
    try {//from  ww w  .  j av a 2  s  .  c  om
        setButtonsEnabled(false);

        if (pushECUQM == null) {
            pushECUQM = connection.resolveStatic(void.class, GMTest.class, "pushValue");
        }

        pushECUQM.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in pushECU()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:com.google.android.gms.common.zze.java

private static void zzan(Context context) {
    if (!zzafR.get()) {
        Integer num;//from  w  ww. j  a  v a  2  s.  c o m
        synchronized (zzqy) {
            if (zzafO == null) {
                zzafO = context.getPackageName();
                try {
                    Bundle bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                            TransportMediator.FLAG_KEY_MEDIA_NEXT).metaData;
                    if (bundle != null) {
                        zzafP = Integer.valueOf(bundle.getInt("com.google.android.gms.version"));
                    } else {
                        zzafP = null;
                    }
                } catch (Throwable e) {
                    Log.wtf("GooglePlayServicesUtil", "This should never happen.", e);
                }
            } else if (!zzafO.equals(context.getPackageName())) {
                throw new IllegalArgumentException(
                        "isGooglePlayServicesAvailable should only be called with Context from your application's package. A previous call used package '"
                                + zzafO + "' and this call used package '" + context.getPackageName() + "'.");
            }
            num = zzafP;
        }
        if (num == null) {
            throw new IllegalStateException(
                    "A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name=\"com.google.android.gms.version\" android:value=\"@integer/google_play_services_version\" />");
        } else if (num.intValue() != GOOGLE_PLAY_SERVICES_VERSION_CODE) {
            throw new IllegalStateException(
                    "The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected "
                            + GOOGLE_PLAY_SERVICES_VERSION_CODE + " but" + " found " + num
                            + ".  You must have the"
                            + " following declaration within the <application> element: "
                            + "    <meta-data android:name=\"" + "com.google.android.gms.version"
                            + "\" android:value=\"@integer/google_play_services_version\" />");
        }
    }
}

From source file:edu.umich.oasis.testapp.TestActivity.java

public void pushOther(View ignored) {
    try {/*from  w  w w .  j av a 2 s  .c  o m*/
        setButtonsEnabled(false);

        if (pushOtherSoda == null) {
            pushOtherSoda = connection.resolveStatic(void.class, GMTest.class, "pushNonValue");
        }

        pushOtherSoda.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in pushOther()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:edu.umich.flowfence.testapp.TestActivity.java

public void pushOther(View ignored) {
    try {// ww w  . j  a va  2  s . c  om
        setButtonsEnabled(false);

        if (pushOtherQM == null) {
            pushOtherQM = connection.resolveStatic(void.class, GMTest.class, "pushNonValue");
        }

        pushOtherQM.call();
    } catch (Exception e) {
        Log.wtf(TAG, "Exception in pushOther()", e);
    } finally {
        Log.i(TAG, "Finishing");
        setButtonsEnabled(true);
    }
}

From source file:com.knurld.alphabank.LoginActivity.java

private void checkUserIsValid(final String username) {

    //        String cachedUsername = KnurldRequestHelper.getFromPref(LoginActivity.this, KnurldRequestHelper.CONSUMER_NAME_KEY);
    //        if (username.equals(cachedUsername)) {
    //            checkEnrollmentIsDoneOrNot();
    //            return;
    //        }// ww  w .  ja  va2 s  . c  om
    Response.Listener<JSONObject> responseListner = new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            boolean isEnrolled = false;
            if (response != null) {
                KnurldRequestHelper.verifyResponse(LoginActivity.this, response.toString());
                try {
                    JSONObject user = response.getJSONArray("items").getJSONObject(0);
                    String href = user.getString("href");
                    isEnrolled = !user.isNull("lastCompletedEnrollment");
                    Log.i(TAG, "New consumer href->" + href);
                    KnurldRequestHelper.setInPref(LoginActivity.this, KnurldRequestHelper.CONSUMER_HREF_KEY,
                            href);
                    KnurldRequestHelper.setInPref(LoginActivity.this, KnurldRequestHelper.CONSUMER_NAME_KEY,
                            username);

                } catch (Exception jse) {
                    Log.wtf(TAG, "Not able to parse the get consumer api response", jse);
                }
                if (isEnrolled) {
                    Log.i(TAG, "User already enrolled so opening dashboard activity...");
                    Intent intent = new Intent(LoginActivity.this, DashboardActivity.class);
                    startActivity(intent);
                } else {
                    Log.i(TAG, "User not enrolled so opening enrollment activity...");
                    Intent intent = new Intent(LoginActivity.this, EnrollmentActivity.class);
                    startActivity(intent);
                }
                //checkEnrollmentIsDoneOrNot();

            }
            Log.i(TAG, response.toString());
        }
    };

    Response.ErrorListener errorListener = new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            progressDialog.dismiss();

            JSONObject response = KnurldRequestHelper.formatVolleyErrorResponse(error);
            int statusCode = KnurldRequestHelper.getErrorCode(response);
            if (statusCode == 400 || statusCode == 401) {
                Intent intent = new Intent(LoginActivity.this, EnrollmentActivity.class);
                startActivity(intent);
            } else {
                Toast.makeText(
                        LoginActivity.this, "Unknown error, please contact administrator statusCode:"
                                + statusCode + " Message:" + KnurldRequestHelper.getErrorMessage(response),
                        Toast.LENGTH_SHORT).show();
            }
        }
    };

    JSONObject parameters = new JSONObject();
    //RequestQueue requestQueue = Volley.newRequestQueue(LoginActivity.this);
    String url = KnurldRequestHelper.buildUrl(KnurldRequestHelper.CONSUMER_ENDPOINT);

    CustomRequest jsObjRequest = new CustomRequest(Request.Method.GET, url, parameters.toString(),
            responseListner, errorListener);
    //        if (!KnurldRequestHelper.isUserLoggedIn()) {
    //            KnurldRequestHelper.Login(LoginActivity.this, jsObjRequest);
    //        } else {
    //            requestQueue.add(jsObjRequest);
    //        }
    AlphaRequestQueue.submit(this, jsObjRequest, true);
}

From source file:com.pixmob.r2droid.DeviceRegistrationService.java

private void onC2DMRegistered() {
    final String regId = Preferences.getRegistrationId(getApplicationContext());
    if (DEV) {/*  w  w  w .  jav  a  2 s.  c  om*/
        Log.i(TAG, "Device registered to C2DM with id " + regId);
    }

    int event = CONNECTED_EVENT;
    String error = null;

    // TODO get device name
    final String deviceName = "Unknown Device";
    try {
        final String url = "https://r2droidhq.appspot.com/api/1/register?regid=" + urlEncode(regId) + "&name="
                + urlEncode(deviceName);
        if (DEV) {
            Log.d(TAG, "Register URL: " + url);
        }
        final HttpGet req = new HttpGet(url);
        if (!configureClient()) {
            event = DISCONNECTED_EVENT;
            error = AUTH_FAILED_ERROR;
        } else {
            final int statusCode = gaeClient.execute(req).getStatusLine().getStatusCode();
            if (statusCode != HTTP_SC_OK) {
                if (DEV) {
                    Log.w(TAG, "Failed to register device: statusCode=" + statusCode);
                }
                event = DISCONNECTED_EVENT;
                error = DEVICE_REGISTRATION_ERROR;
            }
        }
    } catch (AppEngineAuthenticationException e) {
        if (e.isAuthenticationPending()) {
            if (DEV) {
                Log.i(TAG, "User must give permission to use authentication token: " + "registration aborted");
            }
            event = DISCONNECTED_EVENT;
            error = AUTH_PENDING;
        } else {
            if (DEV) {
                Log.w(TAG, "Authentication error", e);
            }
            event = DISCONNECTED_EVENT;
            error = AUTH_FAILED_ERROR;
        }
    } catch (IOException e) {
        if (DEV) {
            Log.w(TAG, "Network error", e);
        }
        event = DISCONNECTED_EVENT;
        error = NETWORK_ERROR;
    } catch (Exception e) {
        Log.wtf(TAG, "Unexpected error", e);
        event = DISCONNECTED_EVENT;
        error = DEVICE_REGISTRATION_ERROR;
    }

    fireEvent(event, error);

    int ticketRes = R.string.device_is_online;
    if (event != CONNECTED_EVENT) {
        ticketRes = R.string.updating_device_failed;
    }
    final Notification notification = new Notification(R.drawable.ic_stat_icon, getString(ticketRes),
            System.currentTimeMillis());
    notification.setLatestEventInfo(this, getString(R.string.app_name), getString(ticketRes), dashboardIntent);
    nm.notify(STATUS_UPDATE_DONE, notification);
}

From source file:de.jadehs.jadehsnavigator.fragment.VorlesungsplanFragment.java

public void updateVPlan() {
    try {/*from ww  w .  j  av  a  2 s. c  o m*/

        // SharedPreference auslesen
        SharedPreferences sp = getActivity().getSharedPreferences("JHSNAV_PREFS", Context.MODE_PRIVATE);
        this.studiengangID = sp.getString("StudiengangID", "");

        this.connectivityManager = (ConnectivityManager) getActivity()
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        this.activeNetwork = connectivityManager.getActiveNetworkInfo();
        this.preferences = new Preferences(getActivity().getApplicationContext());

        url = this.preferences.getVPlanURL() + this.studiengangID + "&weeks=" + this.weekOfYear + "&days=";

        boolean isConnected = (activeNetwork != null) && activeNetwork.isConnectedOrConnecting();

        if (isConnected) {
            this.vPlanTask = new ParseVPlanTask(getActivity(), this.url, this.preferences.getFB(),
                    this.weekOfYear);
            this.vPlanTask.delegate = this;
            this.vPlanTask.execute();
        } else {
            Toast.makeText(getActivity().getApplicationContext(),
                    "Aktualisierung fehlgeschlagen, bitte eine Internetverbindung herstellen.",
                    Toast.LENGTH_LONG).show();
            getVPlanFromDB();
        }
    } catch (Exception ex) {
        Log.wtf("VPlan", "Err", ex);
    }
}

From source file:com.appsimobile.appsii.iab.IabPurchaseHelper.java

/**
 * Consumes a given in-app product. Consuming can only be done on an item
 * that's owned, and as a result of consumption, the user will no longer own it.
 * This method may block or take long to return.
 *
 * @throws IabException if there is a problem during consumption.
 *//*  ww  w .j  a  v  a 2s. c  o m*/
int consume(String sku, String token) {
    checkSetupDone("consume");

    try {
        if (token == null || token.equals("")) {
            logError("Can't consume " + sku + ". No token.");
            return IABHELPER_MISSING_TOKEN;
        }

        logDebug("Consuming sku: " + sku + ", token: " + token);
        int response = mService.consumePurchase(3, mContext.getPackageName(), token);
        if (response == BILLING_RESPONSE_RESULT_OK) {
            logDebug("Successfully consumed sku: " + sku);
        } else {
            logDebug("Error consuming consuming sku " + sku + ". " + getResponseDesc(response));
        }
        return response;
    } catch (RemoteException e) {
        Log.wtf("Appsii", "Remote exception while consuming. Sku: " + sku, e);
        return IABHELPER_REMOTE_EXCEPTION;
    }
}

From source file:com.roamprocess1.roaming4world.syncadapter.SyncAdapter.java

/**
 * Called by the Android system in response to a request to run the sync adapter. The work
 * required to read data from the network, parse it, and store it in the content provider is
 * done here. Extending AbstractThreadedSyncAdapter ensures that all methods within SyncAdapter
 * run on a background thread. For this reason, blocking I/O and other long-running tasks can be
 * run <em>in situ</em>, and you don't have to set up a separate thread for them.
 .
 *
 * <p>This is where we actually perform any work required to perform a sync.
 * {@link AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
 * so it is safe to peform blocking I/O here.
 *
 * <p>The syncResult argument allows you to pass information back to the method that triggered
 * the sync.//from w ww.  j  a v a 2s  .c  o  m
 */
@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
        SyncResult syncResult) {

    Log.d("SyncAdapter", "onPerformSync");

    Log.i(TAG, "Beginning network synchronization");
    try {
        final URL location = new URL(FEED_URL);
        InputStream stream = null;

        try {
            Log.i(TAG, "Streaming data from network: " + location);
            //       stream = downloadUrl(location);
            //       updateLocalFeedData(stream, syncResult);

            // TODO Auto-generated method stub
            prefs = mcontext.getSharedPreferences("com.roamprocess1.roaming4world", Context.MODE_PRIVATE);
            stored_user_mobile_no = "com.roamprocess1.roaming4world.user_mobile_no";
            stored_user_country_code = "com.roamprocess1.roaming4world.user_country_code";
            stored_user_bal = "com.roamprocess1.roaming4world.user_bal";
            stored_min_call_credit = "com.roamprocess1.roaming4world.min_call_credit";
            stored_server_ipaddress = "com.roamprocess1.roaming4world.server_ip";
            signUpProcess = "com.roamprocess1.roaming4world.signUpProcess";

            resultIntent = new Intent(mcontext, SipHome.class);

            mNotificationManager = (NotificationManager) mcontext
                    .getSystemService(Context.NOTIFICATION_SERVICE);
            selfNumber = prefs.getString(stored_user_country_code, "")
                    + prefs.getString(stored_user_mobile_no, "");

            if (getConnectivityStatus(mcontext) != SipHome.TYPE_NOT_CONNECTED) {
                updateUserContacts();

                updateUserImages();
                updateOfflineMissedCalls();

            }
            // Makes sure that the InputStream is closed after the app is
            // finished using it.
        } finally {
            // mcontext.startActivity(new Intent(mcontext , SipHome.class));
            if (stream != null) {
                stream.close();
            }
        }
    } catch (MalformedURLException e) {
        Log.wtf(TAG, "Feed URL is malformed", e);
        syncResult.stats.numParseExceptions++;
        return;
    } catch (IOException e) {
        Log.e(TAG, "Error reading from network: " + e.toString());
        syncResult.stats.numIoExceptions++;
        return;
    }
    Log.i(TAG, "Network synchronization complete");
}