We are now testing our application with a few friends. Sometimes there are some errors which don't throw an exception. So I don't really know whats the problem was. So I thought it would be a good idea to implement a menu item which allows to send the logcat output to a e-mail address, so that we can examine the log.
Unfortunately I didn't find a hint in the Internet how to extract the logcat from a phone. How to send an email shouldn't be the problem.
Look at android-log-collector, as it does what you are trying to do.It is not possible to collect arbitrary LogCat data as of Android 4.1. There was never a documented and supported way of doing that, and the undocumented/unsupported way was locked down in Jelly Bean. For your own crashes, you are better served using a crash logging library, like ACRA.
I'd definitely recommend to look also at this project here
I found the LogCollector very usefull indeed (the tip from CommonsWare):
And don't forget to set in your own application:
I would also look into Flurry (flurry.com) which not only gives you general analytics but allows you to log arbitrary info and also logs uncaught exceptions for you. I set it up in literally 5 minutes, but one thing to keep in mind is that it's not real-time like an email alert. You'll have to wait a few hours for what you log in your app to show up on their dashboard. It could also be overkill if you have a really lightweight app, but I've noticed no performance loss in my app as a result of using the service.
In your manifest file give the following permissions:
In your first/launcher activity, right after the
Write below lines: This will write your App's logcat to your device's external storage
For sending the logcat to desired email address: use below method
Method for checking whether the permissions for Writing to External storage is given or not:
/* Checks if external storage is available for read and write */
This solution doesn't send an email, but sends it to a server through UDP.
https://github.com/Chemik/logcatudp
The source code is available. It can be easily embedded in our own app. I haven't tried to do so.