Example usage for android.util Log w

List of usage examples for android.util Log w

Introduction

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

Prototype

public static int w(String tag, Throwable tr) 

Source Link

Usage

From source file:org.thoughtcrime.securesms.mms.IncomingMmsConnection.java

public RetrieveConf retrieve(boolean usingMmsRadio, boolean useProxyIfAvailable)
        throws IOException, ApnUnavailableException {
    byte[] pdu = null;

    final boolean useProxy = useProxyIfAvailable && apn.hasProxy();
    final String targetHost = useProxy ? apn.getProxy() : Uri.parse(apn.getMmsc()).getHost();
    try {//from www.  ja va2  s.  com
        if (checkRouteToHost(context, targetHost, usingMmsRadio)) {
            Log.w(TAG, "got successful route to host " + targetHost);
            pdu = makeRequest(useProxy);
        }
    } catch (IOException ioe) {
        Log.w(TAG, ioe);
    }

    if (pdu == null) {
        throw new IOException("Connection manager could not obtain route to host.");
    }

    RetrieveConf retrieved = (RetrieveConf) new PduParser(pdu).parse();

    if (retrieved == null) {
        Log.w(TAG, "Couldn't parse PDU, byte response: " + Arrays.toString(pdu));
        Log.w(TAG, "Couldn't parse PDU, ASCII:         " + new String(pdu));
        throw new IOException("Bad retrieved PDU");
    }

    return retrieved;
}

From source file:com.android.email.mail.store.imap.ImapTempFileLiteral.java

@Override
public InputStream getAsStream() {
    checkNotDestroyed();//  w ww.ja v  a 2s  .  co  m
    try {
        return new FileInputStream(mFile);
    } catch (FileNotFoundException e) {
        // It's probably possible if we're low on storage and the system clears the cache dir.
        Log.w(Email.LOG_TAG, "ImapTempFileLiteral: Temp file not found");

        // Return 0 byte stream as a dummy...
        return new ByteArrayInputStream(new byte[0]);
    }
}

From source file:com.emobc.android.utils.RetreiveFileContentTask.java

@Override
protected String doInBackground(URL... params) {
    URL url = params[0];// w ww . java 2 s  .  c  om
    HttpClient httpclient = HttpUtils
            .getHttpClient(url.getProtocol().equalsIgnoreCase(HttpUtils.HTTPS_PROTOCOL));

    HttpUriRequest httpUriRequest = createUriRequest(url);

    try {
        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httpUriRequest);

        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
            String str = EntityUtils.toString(response.getEntity());
            return str;
        } else {
            Log.w("RetreiveFileContentTask: ",
                    "HttpStatus Code: " + String.valueOf(response.getStatusLine().getStatusCode()));
        }
    } catch (ClientProtocolException e) {
        Log.e("RetreiveFileContentTask: ClientProtocolException: ", e.getMessage());
        //          Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();
    } catch (IOException e) {
        Log.e("RetreiveFileContentTask: IOException: ", e.getMessage());
        //          Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();             
    }
    return "";
}

From source file:com.SmartDial.ForegroundService.java

/**
 * Put the service in a foreground state to prevent app from being killed
 * by the OS.//ww w  .  jav a  2 s  . com
 */
public void keepAwake() {
    final Handler handler = new Handler();

    if (!this.inSilentMode()) {
        startForeground(NOTIFICATION_ID, makeNotification());
    } else {
        Log.w("BackgroundMode", "In silent mode app may be paused by OS!");
    }

    BackgroundMode.deleteUpdateSettings();

    keepAliveTask = new TimerTask() {
        @Override
        public void run() {
            handler.post(new Runnable() {
                @Override
                public void run() {
                    // Nothing to do here
                    // Log.d("BackgroundMode", "" + new Date().getTime());
                }
            });
        }
    };

    scheduler.schedule(keepAliveTask, 0, 1000);
}

From source file:com.tapfortap.phonegap.TapForTapPhoneGapPlugin.java

@Override
public PluginResult execute(String action, JSONArray arguments, String callbackId) {
    PluginResult result = null;/*w w  w  .  j a va  2s.co m*/

    Object firstArg = null;
    if (arguments.length() > 0) {
        try {
            firstArg = arguments.get(0);
        } catch (JSONException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
            return new PluginResult(Status.ERROR);
        }
    }

    try {
        Log.d(TAG, "Action " + action + ", arguments: " + arguments);
        if (action.equals("initializeWithAPIKey")) {
            result = initialize((String) firstArg);
        } else if (action.equals("createAdView")) {
            result = createAdView((JSONObject) firstArg);
        } else if (action.equals("loadAds")) {
            result = loadAds((JSONObject) firstArg);
        } else if (action.equals("moveAdView")) {
            result = moveAdView((JSONObject) firstArg);
        } else if (action.equals("removeAdView")) {
            result = removeAdView();
        } else if (action.equals("prepareInterstitial")) {
            result = prepareInterstitial();
        } else if (action.equals("showInterstitial")) {
            result = showInterstitial();
        } else if (action.equals("prepareAppWall")) {
            result = prepareAppWall();
        } else if (action.equals("showAppWall")) {
            result = showAppWall();
        } else {
            Log.w(TAG, "Unknown action " + action + ", arguments: " + arguments);
        }
    } catch (JSONException e) {
        Log.e(TAG, e.getLocalizedMessage(), e);
        result = new PluginResult(Status.JSON_EXCEPTION);
    }

    return result;
}

From source file:com.tih.tihir.ConsumerIrManagerBase.java

@Override
public void start() {
    Log.w(TAG, "start() is not available on this device");
}

From source file:info.guardianproject.netcipher.NetCipher.java

/**
 * Set the global HTTP proxy for all new {@link HttpURLConnection}s and
 * {@link HttpsURLConnection}s that are created after this is called.
 * <p>//from ww w.  j ava 2  s .  com
 * {@link #useTor()} will override this setting.  Traffic must be directed
 * to Tor using the proxy settings, and Orbot has its own proxy settings
 * for connections that need proxies to work.  So if "use Tor" is enabled,
 * as tested by looking for the static instance of Proxy, then no other
 * proxy settings are allowed to override the current Tor proxy.
 *
 * @param proxy the HTTP proxy to use globally
 */
public static void setProxy(Proxy proxy) {
    if (proxy != null && NetCipher.proxy == ORBOT_HTTP_PROXY) {
        Log.w(TAG, "useTor is enabled, ignoring new proxy settings!");
    } else {
        NetCipher.proxy = proxy;
    }
}

From source file:luis.clientebanco.OAuth.UrbankOAuth.java

public void urbankLogin(Context mContext) {

    webService = new WebService();

    String authRequestRedirect = AppContext.UB_APP_OAUTH_URL + "?client_id=" + AppContext.UB_CLIENT_ID
            + "&redirect_uri=" + AppContext.UB_APP_REDIRECT + "&response_type=code"
            + "&scope=permission_read_transaction";

    if (LOGGING.DEBUG)
        Log.d(TAG, "authRequestRedirect->" + authRequestRedirect);

    new UrbankOAuthDialog(mContext, authRequestRedirect, new GenericDialogListener() {

        public void onComplete(Bundle values) {
            if (LOGGING.DEBUG)
                Log.d(TAG, "onComplete->" + values);

            accessCode = "";

            try {

                accessCode = values.getString("code");
                new urbankAccessToken().execute();

            } catch (Exception ex1) {
                Log.w(TAG, ex1.toString());
                accessCode = null;//from  w ww. j av  a 2  s. c om
            }
            Log.v(TAG, "prueba");
        }

        public void onError(String e) {
            if (LOGGING.DEBUG)
                Log.d(TAG, "onError->" + e);
        }

        public void onCancel() {

            if (LOGGING.DEBUG)
                Log.d(TAG, "onCancel()");
        }
    }).show();

}

From source file:cn.suishen.email.mail.store.imap.ImapTempFileLiteral.java

@Override
public InputStream getAsStream() {
    checkNotDestroyed();/*from  w  w w. jav a  2  s. c om*/
    try {
        return new FileInputStream(mFile);
    } catch (FileNotFoundException e) {
        // It's probably possible if we're low on storage and the system clears the cache dir.
        Log.w(Logging.LOG_TAG, "ImapTempFileLiteral: Temp file not found");

        // Return 0 byte stream as a dummy...
        return new ByteArrayInputStream(new byte[0]);
    }
}

From source file:edu.stanford.mobisocial.dungbeetle.obj.action.ExportPhotoAction.java

@Override
public void onAct(Context context, DbEntryHandler objType, DbObj obj) {
    byte[] raw = obj.getRaw();
    if (raw == null) {
        String b64Bytes = obj.getJson().optString(PictureObj.DATA);
        raw = FastBase64.decode(b64Bytes);
    }//  w  w  w .j a  v a2  s. c o  m
    OutputStream outStream = null;
    File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/temp_share.png");
    try {
        outStream = new FileOutputStream(file);

        BitmapManager mgr = new BitmapManager(1);
        Bitmap bitmap = mgr.getBitmap(raw.hashCode(), raw);

        bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream);
        outStream.flush();
        outStream.close();

        bitmap.recycle();
        bitmap = null;
        System.gc();
        Intent intent = new Intent(android.content.Intent.ACTION_SEND);
        intent.setType("image/png");
        Log.w("ResharePhotoAction",
                Environment.getExternalStorageDirectory().getAbsolutePath() + "/temp_share.png");
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        context.startActivity(Intent.createChooser(intent, "Export image to"));

    } catch (Exception e) {
        e.printStackTrace();
    }

}