#Bug Reporter
A simple library to collect the database, cache, files and basic device information from an application.
In your build.gradle
:
repositories {
...
maven { url "https://jitpack.io" }
}
dependencies {
debugCompile 'com.github.doubleencore.de-tools-bugreport-android:bugreport-library:0.4.8'
releaseCompile 'com.github.doubleencore.de-tools-bugreport-android:bugreport-library-no-op:0.4.8'
}
In your Application
class:
public class ExampleApplication extends Application {
@Override public void onCreate() {
super.onCreate();
BugReport.setup(this);
}
}
If you want to trigger a report from a screenshot, in your Activity
or Fragment
class:
public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
BugReport.enableObserver(this);
}
@Override
protected void onPause() {
BugReport.disableObserver();
super.onPause();
}
}
The library which should be included with debug builds requires WRITE_EXTERNAL_STORAGE
and READ_EXTERNAL_STORAGE
. The no-op version does not have any permissions requirements.
If supporting M, the activity which enables the observer, or executes a collection will need to implement onRequestPermissionsResult()
:
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
boolean granted = grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
switch (requestCode) {
case BugReport.ENABLE_OBSERVER:
if (granted) BugReport.enableObserver(this);
break;
case BugReport.EXECUTE_COLLECTION:
if (granted) BugReport.executeCollection(this);
break;
}
}
To manually trigger a report:
BugReport.executeCollection(this);
Or if you have enabled screenshot monitoring, simply trigger a screenshot on the device.
Both will result in a notification displaying which will allow you send a .zip file of the contents.