I want to enable some error report in my app, for that I am searching for a way which works in devices higher than api level 8
My current implementation does not work on a Android 4.1.1 device, there is no action when the user presses the error report button. On a device 2.2, 2.3 and 4.0.4 it shows the different email options.
The action method in my code looks like this
public void startSendErrorAction(View view) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType( "text/plain" );
intent.putExtra( Intent.EXTRA_EMAIL, new String[]{"my@email.de" });
intent.putExtra( Intent.EXTRA_SUBJECT, "PDiXAttach LogReport from " + DateTime.now());
intent.putExtra( Intent.EXTRA_TEXT, getLogContent() );
startActivity(intent);
}
The getLogContent Method retrieves the application log entries with the logcat -d option. But it currently does not work on the device
Hersteller: samsung
Modell: GT-N7100
Marke: samsung
Version: 4.1.1 (REL)
Here the getLogContent-Method
public String getLogContent() {
StringBuffer sb = new StringBuffer();
String separator = System.getProperty( "line.separator" );
Process process;
try {
process = Runtime.getRuntime().exec( "logcat -d" );
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader( process.getInputStream() ) );
String line;
while( (line = bufferedReader.readLine()) != null ) {
sb.append( line );
sb.append( separator );
}
Log.d( TAG, "retrieve log content size is " + sb.length() );
}
catch( IOException e ) {
Log.e( TAG, "error while retrieving logfile of application" + e.getMessage() );
}
return sb.toString();
}
Does someone know what might be the reason.