I'm trying to get all my logcat, which I see in Android Studio
(like here https://i.stack.imgur.com/sseEr.png), to save as a txt file
directly on my device.
What I've tryed so far is this code in the onCreate
:
File logFile = new File(LogcatDir.getAbsolutePath() + "/log.txt" );
try
{
Process process = Runtime.getRuntime().exec( "logcat -c");
process = Runtime.getRuntime().exec( "logcat -f " + logFile + " *:S MyActivity_BUT_WHAT_TO_PUT_HERE");
}
catch ( IOException e ) {e.printStackTrace();}
and in the manifest file
:
<uses-permission android:name="android.permission.READ_LOGS" />
I intentionally did a parse Error like
long test = Long.parseLong("z");
but there was actually only this in the log.txt
:
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
Does anyone know, what I have to code, that I get the whole logcat?