List of usage examples for android.util Log i
public static int i(String tag, String msg)
From source file:com.nullwire.ExceptionHandler.java
/** * Register handler for unhandled exceptions. * @param context//w ww.j a v a2 s. com */ public static boolean register(Context context) { Log.i(TAG, "Registering default exceptions handler"); // Get information about the Package PackageManager pm = context.getPackageManager(); try { PackageInfo pi; // Version pi = pm.getPackageInfo(context.getPackageName(), 0); G.APP_VERSION = pi.versionName; // Package name G.APP_PACKAGE = pi.packageName; // Files dir for storing the stack traces G.FILES_PATH = context.getFilesDir().getAbsolutePath(); // Device model G.PHONE_MODEL = android.os.Build.MODEL; // Android version G.ANDROID_VERSION = android.os.Build.VERSION.RELEASE; } catch (NameNotFoundException e) { e.printStackTrace(); } Log.d(TAG, "TRACE_VERSION: " + G.TraceVersion); Log.d(TAG, "APP_VERSION: " + G.APP_VERSION); Log.d(TAG, "APP_PACKAGE: " + G.APP_PACKAGE); Log.d(TAG, "FILES_PATH: " + G.FILES_PATH); Log.d(TAG, "URL: " + G.URL); boolean stackTracesFound = false; // We'll return true if any stack traces were found if (searchForStackTraces().length > 0) { stackTracesFound = true; } new Thread() { @Override public void run() { // First of all transmit any stack traces that may be lying around submitStackTraces(); UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler(); if (currentHandler != null) { Log.d(TAG, "current handler class=" + currentHandler.getClass().getName()); } // don't register again if already registered if (!(currentHandler instanceof DefaultExceptionHandler)) { // Register default exceptions handler Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(currentHandler)); } } }.start(); return stackTracesFound; }
From source file:im.whistle.crypt.Crypt.java
/** * Generates a private/public key pair./*from w ww . j a v a2s . com*/ * @param args Arguments, element at 0 is the key size * @param callback Callback */ public static void genkeys(JSONArray args, AsyncCallback<JSONArray> callback) { try { Log.i("whistle", "Generating key pair ..."); PRNGProvider.init(); // Ensure OpenSSL fix KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); int bits = args.getInt(0); int exp = args.getInt(1); keyPairGenerator.initialize(new RSAKeyGenParameterSpec(bits, BigInteger.valueOf(exp))); KeyPair keyPair = keyPairGenerator.genKeyPair(); String priv = "-----BEGIN RSA PRIVATE KEY-----\n" + Base64.encodeToString(keyPair.getPrivate().getEncoded(), Base64.DEFAULT).trim() + "\n-----END RSA PRIVATE KEY-----"; String pub = "-----BEGIN PUBLIC KEY-----\n" + Base64.encodeToString(keyPair.getPublic().getEncoded(), Base64.DEFAULT).trim() + "\n-----END PUBLIC KEY-----"; JSONArray res = new JSONArray(); res.put(priv); res.put(pub); callback.success(res); } catch (Exception ex) { Log.w("whistle", "Key pair generation failed: " + ex.getMessage()); callback.error(ex); } }
From source file:org.vuphone.assassins.android.http.HTTPGetter.java
public static HashMap<String, Double> doGameAreaGet() { Log.d(VUphone.tag, pre + "doGameAreaGet called."); String params = "?type=gameAreaGet"; final HttpGet get = new HttpGet(VUphone.SERVER + PATH + params); Log.i(VUphone.tag, pre + "Executing get to " + VUphone.SERVER + PATH + params); return handleGameAreaResponse(get); }
From source file:org.vuphone.assassins.android.http.HTTPPoster.java
public static void doLandMinePost(LandMine lm) { final HttpPost post = new HttpPost(VUphone.SERVER + PATH); post.addHeader("Content-Type", "application/x-www-form-urlencoded"); StringBuffer params = new StringBuffer(); params.append("type=landMinePost&lat=" + lm.getLatitude() + "&lon=" + lm.getLongitude() + "&radius=" + lm.getRadius());//from www. j av a 2 s . c om Log.v(VUphone.tag, pre + "Created parameter string: " + params); post.setEntity(new ByteArrayEntity(params.toString().getBytes())); // Do it Log.i(VUphone.tag, pre + "Executing post to " + VUphone.SERVER + PATH); HttpResponse resp = null; try { resp = c.execute(post); ByteArrayOutputStream bao = new ByteArrayOutputStream(); resp.getEntity().writeTo(bao); Log.d(VUphone.tag, pre + "Response from server: " + new String(bao.toByteArray())); } catch (ClientProtocolException e) { Log.e(VUphone.tag, pre + "ClientProtocolException executing post: " + e.getMessage()); } catch (IOException e) { Log.e(VUphone.tag, pre + "IOException writing to ByteArrayOutputStream: " + e.getMessage()); } catch (Exception e) { Log.e(VUphone.tag, pre + "Other Exception of type:" + e.getClass()); Log.e(VUphone.tag, pre + "The message is: " + e.getMessage()); } }
From source file:demo.vicshady.classes.ErrReport.ExceptionHandler.java
/** * Register handler for unhandled exceptions. * @param context// w w w.ja v a 2 s .co m */ public static boolean register(Context context) { Log.i(TAG, "Registering default exceptions handler"); // Get information about the Package PackageManager pm = context.getPackageManager(); try { PackageInfo pi; // Version pi = pm.getPackageInfo(context.getPackageName(), 0); G.APP_VERSION = pi.versionName; // Package name G.APP_PACKAGE = pi.packageName; // Files dir for storing the stack traces G.FILES_PATH = context.getFilesDir().getAbsolutePath(); // Device model G.PHONE_MODEL = android.os.Build.MODEL; // Android version G.ANDROID_VERSION = android.os.Build.VERSION.RELEASE; } catch (NameNotFoundException e) { e.printStackTrace(); } Log.i(TAG, "TRACE_VERSION: " + G.TraceVersion); Log.d(TAG, "APP_VERSION: " + G.APP_VERSION); Log.d(TAG, "APP_PACKAGE: " + G.APP_PACKAGE); Log.d(TAG, "FILES_PATH: " + G.FILES_PATH); Log.d(TAG, "URL: " + G.URL); boolean stackTracesFound = false; // We'll return true if any stack traces were found if (searchForStackTraces().length > 0) { stackTracesFound = true; } new Thread() { @Override public void run() { // First of all transmit any stack traces that may be lying around submitStackTraces(); UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler(); if (currentHandler != null) { Log.d(TAG, "current handler class=" + currentHandler.getClass().getName()); } // don't register again if already registered if (!(currentHandler instanceof DefaultExceptionHandler)) { // Register default exceptions handler Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(currentHandler)); } } }.start(); return stackTracesFound; }
From source file:com.grinnellplans.plandroid.PlanFetchTask.java
protected String doInBackground(String... params) { Log.i("PlanFetchTask::doInBackground", "Started"); AndroidHttpClient plansClient = AndroidHttpClient.newInstance("plandroid"); final HttpPost req = new HttpPost("http://" + _ss.get_serverName() + "/api/1/index.php?task=read"); List<NameValuePair> postParams = new ArrayList<NameValuePair>(1); postParams.add(new BasicNameValuePair("username", params[0])); postParams.add(new BasicNameValuePair("readlinkreplacement", "/plan/{username}")); Log.i("PlanFetchTask::doInBackground", "setting postParams"); try {//from w ww. j av a 2 s .c o m req.setEntity(new UrlEncodedFormEntity(postParams)); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } HttpResponse response = null; try { Log.i("PlanFetchTask::doInBackground", "executing request"); response = plansClient.execute(req, _httpContext); } catch (IOException e) { e.printStackTrace(); } String resp = null; try { Log.i("PlanFetchTask::doInBackground", "reading response"); resp = new BufferedReader((new InputStreamReader(response.getEntity().getContent()))).readLine(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } plansClient.close(); Log.i("PlanFetchTask::doInBackground", "server responded \"" + resp + "\""); return resp; }
From source file:com.l.notel.notel.org.redpin.android.util.ExceptionReporter.java
/** * Register handler for unhandled exceptions. * //from www. ja va 2 s. c om * @param context */ public static boolean register(Context context) { Log.i(TAG, "Registering default exceptions handler"); // Get information about the Package PackageManager pm = context.getPackageManager(); try { PackageInfo pi; // Version pi = pm.getPackageInfo(context.getPackageName(), 0); E.APP_VERSION = pi.versionName; // Package name E.APP_PACKAGE = pi.packageName; // Files dir for storing the stack traces E.FILES_PATH = context.getFilesDir().getAbsolutePath(); // Device model E.PHONE_MODEL = android.os.Build.MODEL; // Android version E.ANDROID_VERSION = android.os.Build.VERSION.RELEASE; } catch (NameNotFoundException e) { e.printStackTrace(); } Log.i(TAG, "TRACE_VERSION: " + E.TraceVersion); Log.d(TAG, "APP_VERSION: " + E.APP_VERSION); Log.d(TAG, "APP_PACKAGE: " + E.APP_PACKAGE); Log.d(TAG, "FILES_PATH: " + E.FILES_PATH); Log.d(TAG, "URL: " + E.URL); boolean stackTracesFound = false; // We'll return true if any stack traces were found if (searchForStackTraces().length > 0) { stackTracesFound = true; } new Thread() { @Override public void run() { // First of all transmit any stack traces that may be lying // around submitStackTraces(); UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler(); if (currentHandler != null) { Log.d(TAG, "current handler class=" + currentHandler.getClass().getName()); } // don't register again if already registered if (!(currentHandler instanceof ExceptionHandler)) { // Register default exceptions handler Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(currentHandler)); } } }.start(); return stackTracesFound; }
From source file:Main.java
public static void logInfo(String method, String texto) { if (INFO) Log.i(String.valueOf(method), String.valueOf(texto)); }
From source file:com.xiao.smartband.http.XmlHttpResponseHandler.java
public void onSuccess(JSONArray response) { Log.i("info", "xml sucess="); }
From source file:at.florian_lentsch.expirysync.NotifyChecker.java
/** * Sets the alarm that checks for products soon to expire (or already have * expired)/*from w ww . j a v a 2s . c om*/ * * @param context */ protected static void setAlarm(Context context) { Context appContext = context.getApplicationContext(); Intent receiverIntent = new Intent(appContext, NotifyChecker.class); // Fetch info about when the alarm is to sound each day from the shared // preferences: long firstStartMillis = getFirstStartMillis(appContext); if (firstStartMillis < 0) { Log.i("Alarm", "Alert time not configured - not setting alarm"); return; } Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(firstStartMillis); // Log.i("Alarm", "Setting alarm: " + firstStartMillis + ", " + (new // SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", // Locale.US)).format(firstStartMillis)); // Set the alarm: PendingIntent alarmIntent = PendingIntent.getBroadcast(appContext, 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmMgr = (AlarmManager) appContext.getSystemService(Context.ALARM_SERVICE); alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, firstStartMillis, AlarmManager.INTERVAL_DAY, alarmIntent); }