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

The following examples show how to use com.crashlytics.android.Crashlytics#setInt() . 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: App.java    From Resume-Builder with MIT License 6 votes vote down vote up
@Override
protected void log(int priority, String tag, @NonNull String message, Throwable t) {
    if (priority <= Log.INFO) {
        return;
    }

    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 2
Source File: SetupApplication.java    From octoandroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void log(int priority, String tag, String message, Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return;
    }

    if (Crashlytics.getInstance() == null) return; // Should never happen
    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 3
Source File: CrashlyticsTree.java    From Pharmacy-Android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void log(int priority, @Nullable String tag, @Nullable String message, @Nullable Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return;
    }

    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 4
Source File: CrashReportTree.java    From android-mvp-starter with MIT License 6 votes vote down vote up
@Override
protected void log(int priority, String tag, String message, Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return;
    }

    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 5
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 6 votes vote down vote up
private void createPoem() {
    if (poemContainer.getChildCount() > 0) {
        final String poemText = getPoemText();
        final SparseIntArray imgList = poemTheme.getImageList();
        // the line below seems weird, but relies on the fact that the index of SparseIntArray could be any integer
        final int poemImage = imgList.keyAt(imgList.indexOfValue(imgList.get(poemImagePager.getCurrentItem() + 1)));
        Crashlytics.setString(App.CRASHLYTICS_KEY_POEM_TEXT, poemText);
        Crashlytics.setInt(App.CRASHLYTICS_KEY_POEM_IMAGE, poemImage);

        Answers.getInstance().logCustom(new CustomEvent("clicked save poem")
                .putCustomAttribute("poem size", poemText.length())
                .putCustomAttribute("poem theme", poemTheme.getDisplayName())
                .putCustomAttribute("poem image", poemImage));

        AppService.createPoem(getApplicationContext(),
                poemText,
                poemImage,
                poemTheme.getDisplayName(),
                dateFormat.format(Calendar.getInstance().getTime()));
    } else {
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_wordless_poem), Toast.LENGTH_SHORT)
                .show();
        Crashlytics.log("PoemBuilder: User tried to create poem without words on it");
    }
}
 
Example 6
Source File: MAPDownloadController.java    From IndiaSatelliteWeather with GNU General Public License v2.0 6 votes vote down vote up
private Bitmap removeMapBorders(String mapFileName, Bitmap bmp) {
    //Try to remove unwanted parts from MAP. return the original MAP in case of any errors.
    try {
        //Trim the unwanted area from the Ultra Violet Map.
        if (mapFileName.equals(AppConstants.MAP_UV) || mapFileName.equals(AppConstants.MAP_HEAT)) {
            return Bitmap.createBitmap(bmp, 0, 180, 1250, 1400);
        }
    } catch (Exception e) {
        Crashlytics.log("trim MAP Error");
        Crashlytics.setString("MapType", mapFileName);
        try {
            if (bmp != null) {
                Crashlytics.setInt("mapWidth", bmp.getWidth());
                Crashlytics.setInt("mapHeight", bmp.getHeight());
            }
        } catch (Exception e1) {
            Crashlytics.logException(e1);
        }
        Crashlytics.logException(e);
    }
    return bmp;
}
 
Example 7
Source File: JSONUtility.java    From Kernel-Tuner with GNU General Public License v3.0 6 votes vote down vote up
public JSONUtility(Internet.Response serverResponse)
{
    this.serverResponse = serverResponse;
    if (serverResponse.isResponseOk())
    {
        try
        {
            fixResponse();
            jsonObject = new JSONObject(this.serverResponse.responseData);
            checkErrors();
        }
        catch (Exception e)
        {
            if (PrefsManager.DEBUG()) Log.e(Constants.LOG_TAG, "JSONUtility " + e.getMessage());
            if (PrefsManager.DEBUG())
                Log.e(Constants.LOG_TAG, "JSONUtility :: Failed to parse json");
            Crashlytics.setString("response message", serverResponse.responseMessage);
            Crashlytics.setString("response data", serverResponse.responseData);
            Crashlytics.setInt("response code", serverResponse.code);
            Crashlytics.setString("request url", serverResponse.request);
            Crashlytics.logException(e);
        }
    }
}
 
Example 8
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
private void shuffleWords() {
    wordsContainer.removeAllViews();

    final List<String> wordList = wordBank.loadWords();
    for (String w : wordList) {
        final TextView wordView
                = (TextView) getLayoutInflater().inflate(R.layout.word, null, true);
        wordView.setText(w);
        wordView.setOnTouchListener(new WordTouchListener());
        wordView.setTag(w);
        wordsContainer.addView(wordView);
    }

    Crashlytics.setInt(App.CRASHLYTICS_KEY_WORDBANK_COUNT, wordList.size());
}
 
Example 9
Source File: AptoideUtils.java    From aptoide-client with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates the total screens showed and the screens on back stack
 *
 * @param isAdding Indicates if it's to update the number due to a new screen (true) or not (false)
 */
public static void updateNumberOfScreens(boolean isAdding) {
    if (isAdding) {
        totalNumberScreens++;
        numberScreensOnBackStack++;
        Crashlytics.setInt(NUMBER_OF_SCREENS, totalNumberScreens);
        Crashlytics.setInt(NUMBER_OF_SCREENS_ON_BACK_STACK, numberScreensOnBackStack);
    } else {
        numberScreensOnBackStack--;
        Crashlytics.setInt(NUMBER_OF_SCREENS_ON_BACK_STACK, numberScreensOnBackStack);
    }
}
 
Example 10
Source File: MainApp.java    From BusyBox with Apache License 2.0 5 votes vote down vote up
@Override protected void log(int priority, String tag, String message, Throwable t) {
  if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
    return;
  }

  Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
  Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
  Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

  if (t == null) {
    Crashlytics.logException(new Exception(message));
  } else {
    Crashlytics.logException(t);
  }
}
 
Example 11
Source File: RequestQueueManager.java    From Hentoid with Apache License 2.0 5 votes vote down vote up
private RequestQueueManager(Context context) {
    int dlThreadCount = Preferences.getDownloadThreadCount();
    if (dlThreadCount == Preferences.Constant.DOWNLOAD_THREAD_COUNT_AUTO) {
        dlThreadCount = getSuggestedThreadCount(context);
    }
    Crashlytics.setInt("Download thread count", dlThreadCount);

    mRequestQueue = getRequestQueue(context, dlThreadCount);
}
 
Example 12
Source File: RequestQueueManager.java    From Hentoid with Apache License 2.0 5 votes vote down vote up
private static int getSuggestedThreadCount(Context context) {
    final int threshold = 64;
    final int maxThreads = 4;

    int memoryClass = getMemoryClass(context);
    Crashlytics.setInt("Memory class", memoryClass);

    if (memoryClass == 0) return maxThreads;
    int threadCount = (int) Math.ceil((double) memoryClass / (double) threshold);
    return Math.min(threadCount, maxThreads);
}
 
Example 13
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
private void shuffleWords() {
    wordsContainer.removeAllViews();

    final List<String> wordList = wordBank.loadWords();
    for (String w : wordList) {
        final TextView wordView
                = (TextView) getLayoutInflater().inflate(R.layout.word, null, true);
        wordView.setText(w);
        wordView.setOnTouchListener(new WordTouchListener());
        wordView.setTag(w);
        wordsContainer.addView(wordView);
    }

    Crashlytics.setInt(App.CRASHLYTICS_KEY_WORDBANK_COUNT, wordList.size());
}
 
Example 14
Source File: SetIntFunction.java    From ANE-Crashlytics with Apache License 2.0 5 votes vote down vote up
public FREObject call(FREContext context, FREObject[] args) {
	super.call(context, args);
	
	String key = getStringFromFREObject(args[0]);
	int value = getIntFromFREObject(args[1]);
	Crashlytics.setInt(key, value);
	
	return null;
}
 
Example 15
Source File: JSONUtility.java    From Kernel-Tuner with GNU General Public License v3.0 5 votes vote down vote up
public JSONUtility(String stringObject)
{
    this.serverResponse = new Internet.Response();
    serverResponse.code = 200;
    serverResponse.request = null;
    serverResponse.responseData = stringObject;
    serverResponse.responseMessage = null;
    if (serverResponse.isResponseOk())
    {
        try
        {
            fixResponse();
            jsonObject = new JSONObject(this.serverResponse.responseData);
            checkErrors();
        }
        catch (Exception e)
        {
            if (PrefsManager.DEBUG()) Log.e(Constants.LOG_TAG, "JSONUtility " + e.getMessage());
            if (PrefsManager.DEBUG())
                Log.e(Constants.LOG_TAG, "JSONUtility :: Failed to parse json");
            Crashlytics.setString("response message", serverResponse.responseMessage);
            Crashlytics.setString("response data", serverResponse.responseData);
            Crashlytics.setInt("response code", serverResponse.code);
            Crashlytics.setString("request url", serverResponse.request);
            Crashlytics.logException(e);
        }
    }
}
 
Example 16
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 4 votes vote down vote up
private void createPoem() {
    if (poemContainer.getChildCount() > 0) {
        final String poemText = getPoemText();
        final int poemImage = getPoemImageId();

        Crashlytics.setString(App.CRASHLYTICS_KEY_POEM_TEXT, poemText);
        Crashlytics.setInt(App.CRASHLYTICS_KEY_POEM_IMAGE, poemImage);

        long creationTimeStamp = System.currentTimeMillis() / 1000L;

        Poem newPoem = new Poem(poemText, poemImage, poemTheme.getDisplayName(), creationTimeStamp);
        FirebaseHelpers.savePoem(newPoem).addOnCompleteListener(new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    Toast.makeText(getApplicationContext(),
                            "Poem saved!", Toast.LENGTH_SHORT)
                            .show();
                } else {
                    Toast.makeText(getApplicationContext(),
                            "Problem saving poem", Toast.LENGTH_SHORT)
                            .show();
                }
            }
        });

        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("save_poem", bundle);

        final Intent i = new Intent(getApplicationContext(), PoemHistoryActivity.class);
        i.putExtra(ThemeChooserActivity.IS_NEW_POEM, true);
        startActivity(i);
    } else {
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_wordless_poem), Toast.LENGTH_SHORT)
                .show();
        Crashlytics.log("PoemBuilder: User tried to create poem without words on it");
    }
}