Example usage for android.util Log INFO

List of usage examples for android.util Log INFO

Introduction

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

Prototype

int INFO

To view the source code for android.util Log INFO.

Click Source Link

Document

Priority constant for the println method; use Log.i.

Usage

From source file:com.irccloud.android.activity.BaseActivity.java

@Override
protected void onPostResume() {
    super.onPostResume();
    if (conn != null) {
        Crashlytics.log(Log.INFO, "IRCCloud", "App resumed, websocket state: " + conn.getState());
        if (conn.getState() == NetworkConnection.STATE_DISCONNECTED
                || conn.getState() == NetworkConnection.STATE_DISCONNECTING)
            conn.connect(true);//from   w  w  w .j a  va  2s  . c  o  m
    }
}

From source file:com.kth.common.utils.etc.LogUtil.java

/**
 * Stack Trace  ?./*from  ww w . j  a v a 2  s.com*/
 * 
 * @param clazz  ??  Class.
 */
public static void stackTrace(final Class<?> clazz) {
    stackTrace(clazz, Log.INFO, null);
}

From source file:biz.bokhorst.xprivacy.Util.java

public static String[] getProLicenseUnchecked() {
    // Get license file name
    String storageDir = Environment.getExternalStorageDirectory().getAbsolutePath();
    File licenseFile = new File(storageDir + File.separator + LICENSE_FILE_NAME);
    if (!licenseFile.exists())
        licenseFile = new File(storageDir + File.separator + ".xprivacy" + File.separator + LICENSE_FILE_NAME);
    if (!licenseFile.exists())
        licenseFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
                + File.separator + LICENSE_FILE_NAME);

    String importedLicense = importProLicense(licenseFile);
    if (importedLicense == null)
        return null;

    // Check license file
    licenseFile = new File(importedLicense);
    if (licenseFile.exists()) {
        // Read license
        try {/*from w  ww  .j a va2s  . c om*/
            IniFile iniFile = new IniFile(licenseFile);
            String name = iniFile.get("name", "");
            String email = iniFile.get("email", "");
            String signature = iniFile.get("signature", "");
            if (name == null || email == null || signature == null)
                return null;
            else {
                // Check expiry
                if (email.endsWith("@faircode.eu")) {
                    long expiry = Long.parseLong(email.split("\\.")[0]);
                    long time = System.currentTimeMillis() / 1000L;
                    if (time > expiry) {
                        Util.log(null, Log.WARN, "Licensing: expired");
                        return null;
                    }
                }

                // Valid
                return new String[] { name, email, signature };
            }
        } catch (FileNotFoundException ex) {
            return null;
        } catch (Throwable ex) {
            bug(null, ex);
            return null;
        }
    } else
        Util.log(null, Log.INFO, "Licensing: no license file");
    return null;
}

From source file:com.kth.common.utils.etc.LogUtil.java

/**
 * Stack Trace  ?.//from   w w w .j a v  a2  s  .  c  om
 * 
 * @param clazz  ??  Class.
 * @param msg .
 */
public static void stackTrace(final Class<?> clazz, final String msg) {
    stackTrace(clazz, Log.INFO, msg);
}

From source file:com.cbsb.ftpserv.ProxyConnector.java

private boolean checkAndPrintJsonError(JSONObject json) throws JSONException {
    if (json.has("error_code")) {
        // The returned JSON object will have a field called "errorCode"
        // if there was a problem executing our request.
        StringBuilder s = new StringBuilder("Error in JSON response, code: ");
        s.append(json.getString("error_code"));
        if (json.has("error_string")) {
            s.append(", string: ");
            s.append(json.getString("error_string"));
        }/*  w ww. j  a  v  a 2s . c  om*/
        myLog.l(Log.INFO, s.toString());

        // Obsolete: there's no authentication anymore
        // Dev code to enable frequent database wipes. If we fail to login,
        // remove our stored account info, causing a create_account action
        // next time.
        //if(!Defaults.release) {
        //   if(json.getInt("error_code") == 11) {
        //      myLog.l(Log.DEBUG, "Dev: removing secret due to login failure");
        //      removeSecret();
        //   }
        //}
        return true;
    }
    return false;
}

From source file:com.radicaldynamic.groupinform.services.InformOnlineService.java

private boolean checkout() {
    boolean saidGoodbye = false;

    String checkoutUrl = Collect.getInstance().getInformOnlineState().getServerUrl() + "/checkout";
    String getResult = HttpUtils.getUrlData(checkoutUrl);
    JSONObject checkout;/*from   w ww  .ja v a 2  s . c  o  m*/

    try {
        checkout = (JSONObject) new JSONTokener(getResult).nextValue();

        String result = checkout.optString(InformOnlineState.RESULT, InformOnlineState.ERROR);

        if (result.equals(InformOnlineState.OK)) {
            if (Collect.Log.INFO)
                Log.i(Collect.LOGTAG, t + "said goodbye to Group Complete");
        } else {
            if (Collect.Log.DEBUG)
                Log.d(Collect.LOGTAG, t + "device checkout unnecessary");
        }

        saidGoodbye = true;
    } catch (NullPointerException e) {
        // Communication error
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, t + "no getResult to parse.  Communication error with node.js server?");
        e.printStackTrace();
    } catch (JSONException e) {
        // Parse error (malformed result)
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, t + "failed to parse getResult " + getResult);
        e.printStackTrace();
    } finally {
        // Running a checkout ALWAYS "signs us out"
        mSignedIn = false;
    }

    Collect.getInstance().getInformOnlineState().setSession(null);

    return saidGoodbye;
}

From source file:com.google.android.gcm.demo.logic.DeviceGroupsHelper.java

/**
 * Execute the HTTP call to remove registration_ids from a the Device Group.
 *
 * <code>/*from   www  .j a  va  2  s .  c o m*/
 *   Content-Type: application/json
 *   Authorization: key=API_KEY
 *   project_id: SENDER_ID
 *   {
 *     "operation": "remove",
 *     "notification_key_name": "appUser-Chris",
 *     "notification_key": "aUniqueKey",
 *     "registration_ids": ["4", "8", "15", "16", "23", "42"]
 *   }
 * </code>
 */
public void removeMembers(String senderId, String apiKey, String groupName, String groupKey, Bundle members) {
    try {
        HttpRequest httpRequest = new HttpRequest();
        httpRequest.setHeader(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON);
        httpRequest.setHeader(HEADER_AUTHORIZATION, "key=" + apiKey);
        httpRequest.setHeader(HEADER_PROJECT_ID, senderId);

        JSONObject requestBody = new JSONObject();
        requestBody.put("operation", "remove");
        requestBody.put("notification_key_name", groupName);
        requestBody.put("notification_key", groupKey);
        requestBody.put("registration_ids", new JSONArray(bundleValues2Array(members)));

        httpRequest.doPost(GCM_GROUPS_ENDPOINT, requestBody.toString());

        JSONObject responseBody = new JSONObject(httpRequest.getResponseBody());

        if (responseBody.has("error")) {
            mLogger.log(Log.INFO, "Error while removing group members." + "\ngroupName: " + groupName
                    + "\ngroupKey: " + groupKey + "\nhttpResponse: " + httpRequest.getResponseBody());
            MainActivity.showToast(mContext, R.string.group_toast_remove_members_failed,
                    responseBody.getString("error"));
        } else {
            // Store the group in the local storage.
            SenderCollection senders = SenderCollection.getInstance(mContext);
            Sender sender = senders.getSender(senderId);
            DeviceGroup newGroup = sender.groups.get(groupName);
            for (String name : members.keySet()) {
                newGroup.tokens.remove(name);
            }
            senders.updateSender(sender);

            mLogger.log(Log.INFO, "Group members removed successfully." + "\ngroupName: " + groupName
                    + "\ngroupKey: " + groupKey);
            MainActivity.showToast(mContext, R.string.group_toast_remove_members_succeeded);
        }
    } catch (JSONException | IOException e) {
        mLogger.log(Log.INFO, "Exception while removing group members." + "\nerror: " + e.getMessage()
                + "\ngroupName: " + groupName + "\ngroupKey: " + groupKey);
        MainActivity.showToast(mContext, R.string.group_toast_remove_members_failed, e.getMessage());
    }
}

From source file:org.swiftp.server.ProxyConnector.java

private boolean checkAndPrintJsonError(JSONObject json) throws JSONException {
    if (json.has("error_code")) {
        // The returned JSON object will have a field called "errorCode"
        // if there was a problem executing our request.
        StringBuilder s = new StringBuilder("Error in JSON response, code: ");
        s.append(json.getString("error_code"));
        if (json.has("error_string")) {
            s.append(", string: ");
            s.append(json.getString("error_string"));
        }/*from   ww w .jav a2s  . c  o m*/
        myLog.l(Log.INFO, s.toString());

        // Obsolete: there's no authentication anymore
        // Dev code to enable frequent database wipes. If we fail to login,
        // remove our stored account info, causing a create_account action
        // next time.
        // if(!Defaults.release) {
        // if(json.getInt("error_code") == 11) {
        // myLog.l(Log.DEBUG, "Dev: removing secret due to login failure");
        // removeSecret();
        // }
        // }
        return true;
    }
    return false;
}

From source file:com.cryart.sabbathschool.viewmodel.SSQuarterliesViewModel.java

private void loadQuarterlies(SSQuarterlyLanguage ssQuarterlyLanguage) {
    ssQuarterliesRef = ssFirebaseDatabase.child(SSConstants.SS_FIREBASE_QUARTERLIES_DATABASE)
            .child(ssQuarterlyLanguage.code).addValueEventListener(new ValueEventListener() {
                @Override/*  w w  w . j  a  va 2  s  . c o m*/
                public void onDataChange(DataSnapshot dataSnapshot) {
                    if (dataSnapshot != null) {
                        try {
                            Iterable<DataSnapshot> data = dataSnapshot.getChildren();

                            if (ssQuarterlies == null) {
                                ssQuarterlies = new ArrayList<>();
                            } else {
                                ssQuarterlies.clear();
                            }

                            for (DataSnapshot d : data) {
                                ssQuarterlies.add(d.getValue(SSQuarterly.class));
                            }

                            if (dataListener != null)
                                dataListener.onQuarterliesChanged(ssQuarterlies);

                            ssQuarterliesListVisibility.set(View.VISIBLE);
                            ssQuarterliesLoadingVisibility.set(View.INVISIBLE);
                            ssQuarterliesErrorMessageVisibility.set(View.INVISIBLE);
                            ssQuarterliesEmptyStateVisibility.set(View.INVISIBLE);
                            ssQuarterliesErrorStateVisibility.set(View.INVISIBLE);

                            if (ssQuarterlies.size() == 0) {
                                ssQuarterliesEmptyStateVisibility.set(View.VISIBLE);
                            }
                        } catch (Exception e) {
                            Crashlytics.log(Log.INFO, TAG, e.getMessage());
                        }
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    ssQuarterliesErrorMessageVisibility.set(View.VISIBLE);
                    ssQuarterliesListVisibility.set(View.INVISIBLE);
                    ssQuarterliesLoadingVisibility.set(View.INVISIBLE);
                    ssQuarterliesEmptyStateVisibility.set(View.INVISIBLE);
                    ssQuarterliesErrorStateVisibility.set(View.VISIBLE);
                }
            });
}

From source file:com.kth.common.utils.etc.LogUtil.java

/**
 * INFO  ? ?  ?.
 */
public static boolean isInfoEnabled() {
    return Log.isLoggable(TAG, Log.INFO);
}