Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FirebaseCrashReporting
/*
***Logging Type1***
*/
//to just log actions to the Firebase Dashboard you can use this
FirebaseCrash.log("Some message that you want to log");
//This type of logging is going to be analogous to this:
Log.d(TAG, "Some message that you want to log");
/*
***Logging Type2***
*/
//Surround sections of code in a try/catch to catch a specific type of error.
//In the example below I try to read a file that doesn't exist.
try{
File file = new File(filepath);
InputStream inputStream = new FileInputStream(file);
inputStream.read();
}catch (FileNotFoundException e){
FirebaseCrash.report(new Exception(
"FileNotFoundException in btnError2. Probably the filepath:" + filepath
));
} catch (IOException e) {
FirebaseCrash.report(new Exception(
e.toString()
));
}
/*
***Logging Type3***
*/
//This is just a default log that the Firebase Dashboard will get when the app crashes.
//You don't need to do anything it will do it automatically.
//this will throw an exception because the index is out of bounds
for (int i = 0; i <= theList.size(); i++){
Log.d(TAG, "onClick: theList: " + theList.get(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.