Java Code Examples for com.crashlytics.android.Crashlytics#log()

The following examples show how to use com.crashlytics.android.Crashlytics#log() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getBooleanExtra(App.BROADCAST_POEM_CREATION_RESULT, false)) {
        Crashlytics.log("PoemBuilder: poem saved, receiver called");
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_poem_created), Toast.LENGTH_SHORT)
                .show();
        final Intent i = new Intent(getApplicationContext(), PoemHistoryActivity.class);
        i.putExtra(ThemeChooserActivity.IS_NEW_POEM, true);
        startActivity(i);
    } else {
        Crashlytics.log("PoemBuilder: error when saving poem");
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_poem_error), Toast.LENGTH_SHORT)
                .show();
        finish();
    }
}
 
Example 2
Source File: NewsCatFileUtil.java    From Gazetti_Newspaper_Reader with MIT License 6 votes vote down vote up
public void updateNewsCatFileWithNewAssets() {
    try {
        String jsonString = readFromFile(NEWS_CAT_FILE, true);
        Crashlytics.log(Log.INFO, LOG_TAG, "newJsonString - "+jsonString);

        Map<String, Object> newFullJsonMap = JsonHelper.toMap(new JSONObject(jsonString));
        Crashlytics.log(Log.INFO, LOG_TAG, "newFullJsonMap - " + newFullJsonMap.toString());

        convertUserFeedMapToJsonMap(newFullJsonMap);
        Map<String, List<String>>  newUserSelectionMap = getUserFeedMapFromJsonMap(newFullJsonMap);
        Crashlytics.log(Log.INFO, LOG_TAG, "newUserSelectionMap - "+newUserSelectionMap);

        setUserSelectionMap(newUserSelectionMap);

    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: BookmarkDataSource.java    From Gazetti_Newspaper_Reader with MIT License 6 votes vote down vote up
public void createBookmarkModelEntry(BookmarkModel bookmarkModel) {
    ContentValues values = new ContentValues();
    try {
        values.put(SQLiteHelper.COLUMN_NEWSPAPER_NAME, bookmarkModel.getNewspaperName());
        values.put(SQLiteHelper.COLUMN_CATEGORY_NAME, bookmarkModel.getCategoryName());
        values.put(SQLiteHelper.COLUMN_NEWS_HEADLINE, bookmarkModel.getmArticleHeadline());
        values.put(SQLiteHelper.COLUMN_NEWS_BODY, bookmarkModel.getmArticleBody());
        values.put(SQLiteHelper.COLUMN_NEWS_ARTICLE_URL, bookmarkModel.getmArticleURL());
        values.put(SQLiteHelper.COLUMN_NEWS_PUB_DATE, bookmarkModel.getmArticlePubDate());
        values.put(SQLiteHelper.COLUMN_NEWS_IMAGE_URL, bookmarkModel.getmArticleImageURL());
    } catch (SQLiteConstraintException sqe){
        Crashlytics.log("Exception while creating sqlite entry - " + sqe.getMessage());
    }
    long insertId = database.insert(SQLiteHelper.TABLE_READ_IT_LATER, null,
            values);
    //Log.d(TAG, "Created entry "+insertId);

    Cursor cursor = database.query(SQLiteHelper.TABLE_READ_IT_LATER,
            allColumns, SQLiteHelper.COLUMN_ID + " = " + insertId, null,
            null, null, null);
    cursor.moveToFirst();
    cursor.close();
}
 
Example 4
Source File: PoemHistoryActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getBooleanExtra(App.BROADCAST_POEM_DELETION_RESULT, false)) {
        Crashlytics.log("PoemBuilder: poem removed, receiver called");
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_poem_deleted),
                Toast.LENGTH_SHORT).show();
    } else {
        Crashlytics.log("PoemHistory: error when removing poem");
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_poem_delete_error),
                Toast.LENGTH_SHORT).show();
    }
}
 
Example 5
Source File: BookmarkDetailFragment.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    try {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(mArticleURL)));
    } catch (Exception e) {
        Crashlytics.log("mArticleURL is null -- "+(null==mArticleURL));
    }
}
 
Example 6
Source File: SessionRecorder.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
private static void recordSessionState(String message,
                                       String userIdentifier,
                                       boolean active) {
    Crashlytics.log(message);
    Crashlytics.setUserIdentifier(userIdentifier);
    Crashlytics.setBool(App.CRASHLYTICS_KEY_SESSION_ACTIVATED, active);
}
 
Example 7
Source File: WebsiteListActivity.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
@Override
public void onItemSelected(String headlineText, NewsAdapter newsAdapter) {
    try {
        if(headlineText!=null){
            if (mTwoPane) {
                Bundle arguments = new Bundle();
                arguments.putString("npName", npName);
                arguments.putString("catName", catName);
                arguments.putInt("actionBarColor", currentColor);
                arguments.putString(WebsiteDetailFragment.HEADLINE_CLICKED, headlineText);
                WebsiteDetailFragment detailFragment = new WebsiteDetailFragment();
                detailFragment.setArguments(arguments);
                getSupportFragmentManager().beginTransaction()
                        .replace(R.id.website_detail_container, detailFragment, "detail").commit();
            } else {
                Intent detailIntent = new Intent(this, WebsiteDetailActivity.class);
                detailIntent.putExtra("npName", npName);
                detailIntent.putExtra("catName", catName);
                detailIntent.putExtra(WebsiteDetailFragment.HEADLINE_CLICKED, headlineText);
                detailIntent.putExtra("ActionBarColor", currentColor);
                detailIntent.putExtra("ActionBarTitle", npName + " - " + catName);
                startActivity(detailIntent);
            }
        } else {
            Crashlytics.log("Headline clicked is null ? " + (null == headlineText));
        }
    } catch (Exception e) {
        Crashlytics.logException(e);
    }
}
 
Example 8
Source File: ProfileHeaderView.java    From 1Rramp-Android with MIT License 5 votes vote down vote up
@Override
public void onSyncCompleted() {
  try {
    invalidateFollowButton();
  }
  catch (Exception e) {
    Crashlytics.log(e.toString());
  }
}
 
Example 9
Source File: NewsCatFileUtil.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
private void initUserSelectionMap() {
    try {
        String jsonString = readFromFile(NEWS_CAT_FILE);
        Crashlytics.log(Log.INFO, LOG_TAG, "jsonString - "+jsonString);

        fullJsonMap = JsonHelper.toMap(new JSONObject(jsonString));
        Crashlytics.log(Log.INFO, LOG_TAG, "fullJsonMap - " + fullJsonMap.toString());

        userSelectionMap = getUserFeedMapFromJsonMap(fullJsonMap);
        Crashlytics.log(Log.INFO, LOG_TAG, "UserSelectionMap - " + userSelectionMap.toString());
    } catch (JSONException e) {
        Crashlytics.logException(e);
    }
}
 
Example 10
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    Crashlytics.log("PoemBuilder: getting back, user cancelled the poem creation");

    Bundle bundle  = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, poemTheme.getDisplayName());
    bundle.putInt("length", poemContainer.getChildCount());
    // this disagrees with cannonball-iOS, since cannonball-iOS saves a full file name
    bundle.putString("picture", getPoemImageId() + "");
    mFirebaseAnalytics.logEvent("gave_up_building_poem", bundle);

    super.onBackPressed();
    countDown.cancel();
}
 
Example 11
Source File: UserInfoFragment.java    From 1Rramp-Android with MIT License 5 votes vote down vote up
private void userUnFollowedOnSteem() {
  try {
    showFollowProgress(false);
    setFollowState(false);
    syncFollowings();
    fetchFollowingInfo();
    t("You unfollowed " + mUsername);
  }
  catch (Exception e) {
    Crashlytics.log(e.toString());
  }
}
 
Example 12
Source File: DetailedActivity.java    From 1Rramp-Android with MIT License 5 votes vote down vote up
private void setSteemEarnings(Feed feed) {
  try {
    double pendingPayoutValue = Double.parseDouble(feed.getPendingPayoutValue().split(" ")[0]);
    double totalPayoutValue = Double.parseDouble(feed.getTotalPayoutValue().split(" ")[0]);
    double curatorPayoutValue = Double.parseDouble(feed.getCuratorPayoutValue().split(" ")[0]);
    double maxAcceptedValue = Double.parseDouble(feed.getMaxAcceptedPayoutValue().split(" ")[0]);
    String briefPayoutValueString;
    if (pendingPayoutValue > 0) {
      payoutValue.setVisibility(VISIBLE);
      dollarIcon.setVisibility(VISIBLE);
      briefPayoutValueString = String.format(Locale.US, "%1$.3f", pendingPayoutValue);
      payoutValue.setText(briefPayoutValueString);
    } else if ((totalPayoutValue + curatorPayoutValue) > 0) {
      //cashed out
      payoutValue.setVisibility(VISIBLE);
      dollarIcon.setVisibility(VISIBLE);
      briefPayoutValueString = String.format(Locale.US, "%1$.3f", (totalPayoutValue + curatorPayoutValue));
      payoutValue.setText(briefPayoutValueString);
    } else {
      payoutValue.setVisibility(GONE);
      dollarIcon.setVisibility(GONE);
    }

    //format payout string
    if (maxAcceptedValue == 0) {
      payoutValue.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      payoutValue.setPaintFlags(Paint.LINEAR_TEXT_FLAG);
    }
  }
  catch (Exception e) {
    Crashlytics.log(e.toString());
  }
}
 
Example 13
Source File: UserInfoFragment.java    From 1Rramp-Android with MIT License 5 votes vote down vote up
private void cacheUserProfile(User user) {
  if (user.getUsername() == null) {
    Crashlytics.log(mUsername + ":Incorrect profile Info is cached:" + user.toString());
  }
  String json = new Gson().toJson(user);
  HaprampPreferenceManager.getInstance().saveUserProfile(mUsername, json);
}
 
Example 14
Source File: BaseFragment.java    From quill with MIT License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Crashlytics.log(Log.DEBUG, TAG, mClassName + "#onCreateView()");
    return null;
}
 
Example 15
Source File: WebsiteDetailFragment.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    dataSource = new BookmarkDataSource(getActivity());
    dataSource.open();
    setRetainInstance(true);
    try {
        if(getArguments()!=null){
            npNameString = getArguments().getString("npName");
            catNameString = getArguments().getString("catName");
            actionBarColor = getArguments().getInt("actionBarColor");

            if (getArguments().containsKey(HEADLINE_CLICKED)) {
                mArticleHeadline = getArguments().getString(HEADLINE_CLICKED);
                mArticleURL = NewsAdapter.linkMap.get(mArticleHeadline);
                mArticlePubDate = NewsAdapter.pubDateMap.get(mArticleHeadline);
            } else {
                Crashlytics.log("Argument contains key -- "+HEADLINE_CLICKED+"--"+(getArguments().containsKey(HEADLINE_CLICKED)));
            }

        } else {
            Crashlytics.log("Get Arguments is null -- "+(null==getArguments()));
        }
    } catch (Exception e) {
        Crashlytics.log("Get Arguments is null -- "+(null==getArguments()));
        Crashlytics.log("Argument contains key -- "+HEADLINE_CLICKED+"--"+(getArguments().containsKey(HEADLINE_CLICKED)));
        Crashlytics.log("Null -- "
                +(npNameString==null)
                +(catNameString==null)
                +(actionBarColor==0)
                +(mArticleHeadline==null)
                +(mArticleURL==null)
                +(mArticlePubDate==null)
        );
    }

    mDetector = new GestureDetectorCompat(getActivity(), new MyGestureListener());
    slide_down = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_down);

}
 
Example 16
Source File: BaseActivity.java    From quill with MIT License 4 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    Crashlytics.log(Log.DEBUG, TAG, this.getClass().getSimpleName() + "#onResume()");
}
 
Example 17
Source File: BaseFragment.java    From quill with MIT License 4 votes vote down vote up
@Override
public void onDestroyView() {
    super.onDestroyView();
    Crashlytics.log(Log.DEBUG, TAG, mClassName + "#onDestroyView()");
    unbindView();
}
 
Example 18
Source File: tools.java    From HAPP with GNU General Public License v3.0 4 votes vote down vote up
public static List<TimeSpan> getProfile(String profile, int index, SharedPreferences prefs){
    String profileArrayName="";
    List<String> profileArray;
    List<TimeSpan> timeSpansList;

    switch (profile) {
        case Constants.profile.ISF_PROFILE:
            profileArrayName    =   Constants.profile.ISF_PROFILE_ARRAY;
            break;
        case Constants.profile.BASAL_PROFILE:
            profileArrayName    =   Constants.profile.BASAL_PROFILE_ARRAY;
            break;
        case Constants.profile.CARB_PROFILE:
            profileArrayName    =   Constants.profile.CARB_PROFILE_ARRAY;
            break;
    }

    if (profileArrayName.equals("")){
        Log.e(TAG, "Unknown profile: " + profile + ", not sure what profile to load");
        Crashlytics.log(1,TAG,"Unknown profile: " + profile + ", not sure what profile to load");
        return newEmptyProfile();

    } else {
        String profileArrayJSON = prefs.getString(profileArrayName, "");                                        //RAW array of Profiles JSON

        if (profileArrayJSON.equals("")) {
            //cannot find any profiles, return an empty one
            Crashlytics.log(1,TAG,"cannot find any profiles, return an empty one: " + profile);
            timeSpansList = newEmptyProfile();
        } else {
            profileArray = new Gson().fromJson(profileArrayJSON, new TypeToken<List<String>>() {}.getType());   //The array of Profiles
            String profileJSON = profileArray.get(index);                                                       //Raw Profile JSON
            try {
                timeSpansList = new Gson().fromJson(profileJSON, new TypeToken<List<TimeSpan>>() {}.getType()); //The Profile itself
            } catch (JsonSyntaxException j){
                Crashlytics.log("profileJSON: " + profileJSON);
                Crashlytics.logException(j);
                Log.e(TAG, "Error getting profileJSON: " + j.getLocalizedMessage() + " " + profileJSON);
                timeSpansList = newEmptyProfile();
            }
        }

        return timeSpansList;
    }
}
 
Example 19
Source File: BaseActivity.java    From quill with MIT License 4 votes vote down vote up
@Override
public void onLowMemory() {
    super.onLowMemory();
    Crashlytics.log(Log.DEBUG, TAG, this.getClass().getSimpleName() + "#onLowMemory()");
}
 
Example 20
Source File: CrashlyticsLogger.java    From pandroid with Apache License 2.0 4 votes vote down vote up
@Override
public void info(String tag, String msg, Throwable tr) {
    if(initialized) {
        Crashlytics.log(INFO, msg, tr != null ? tr.getMessage() : "");
    }
}