Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I trigger Android's built-in bug capture functionality from my app?

Android has, from ICS onwards (I think) provided the ability for a user to capture the system state, and then send or share the captured data with whomever they wish. See What does it mean with bug report captured in android tablet?

The captured data includes a screenshot, list of running processes, Logcat contents, active threads for each process, etc.

This is fantastically useful, but triggering it seems to involve the user pressing funny key combinations (Power + VolumeUp + VolumeDown) or enabling Developer mode and choosing specific options from there (Take bug report, Power menu bug reports).

Is there a way I can trigger this from my own code, so that I can offer my users a simple menu option to capture a bug report?

like image 755
Graham Borland Avatar asked May 28 '14 20:05

Graham Borland


People also ask

What is bug report captured on Android?

Android bug report The purpose is to get information such as “device logs, stack traces, and other diagnostic information to help you find and fix bugs in your app.” With this function, you can capture bugs directly from devices, emulators, or adb's.

Where are Android bug reports stored?

Bug reporting can now be added to the list of improved areas. As before, you can report a bug from the developer options settings menu or with the power button shortcut if you enable it. Now, you should be able to view reports you've made via the Files app on your Pixel phone.

How do I fix the bugs on my Android phone?

Sometimes when an app is installed or updated, some erros show up. Some of them can be easily fixed following the steps below on your Android settings: Search for the option Apps & Notifications, then App info, search for Kyte, tap on storage & memory.


1 Answers

Reading up on the link that you have posted - What does it mean with bug report captured in android tablet?

The [answer] marked as correct says bugmailer.sh in the system/bin does the reporting.

So, in theory if you could detect an app crash using any of these methods, then you could execute your own copy of bugmailer.sh in the sdcard and get a report.

Source for bugmailer.sh: https://android.googlesource.com/platform/system/extras/+/android-4.2.2_r1/bugmailer/bugmailer.sh

However, you will realize that this will obviously work only for rooted phones as you read the source.

The easier way would be to open the Developer options and have a system overlay window pointing at what they should click. This would be the only user friendly solution for non rooted phones.

You can open the Developer options using

startActivity(new Intent(
    Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS));

For further reference.

like image 141
Karthik Balakrishnan Avatar answered Sep 18 '22 13:09

Karthik Balakrishnan