9

I would like to launch com.google.android.feedback.FeedbackActivity for my application. Like it happens in Hangouts application.

Does anyone knows which extras I need to pass to do so?

Send feedback for Hangouts

pixel
  • 24,905
  • 36
  • 149
  • 251
  • 1
    This is not part of the Android SDK. – CommonsWare May 27 '13 at 10:30
  • Hmm... even if you will be able to launch `com.google.android.feedback.FeedbackActivity` the feedback would probably end up at Google. Why would anyone do that? – ozbek May 29 '13 at 10:21
  • I guess that it will end up at Google Play Console of reporting application. – pixel May 29 '13 at 11:39
  • @CommonsWare It is. See: [Intent.ACTION_APP_ERROR](http://developer.android.com/reference/android/content/Intent.html#ACTION_APP_ERROR) and [ApplicationErrorReport](http://developer.android.com/reference/android/app/ApplicationErrorReport.html) – pixel Jul 16 '13 at 08:20
  • See also [How to use Intent.ACTION_APP_ERROR as a means for a “feedback”](http://stackoverflow.com/questions/10559267/how-to-use-intent-action-app-error-as-a-means-for-a-feedback-framework-in-andr/16232417#16232417) – rds Jun 10 '14 at 11:59

3 Answers3

2

So it seems that this is possible, bur report is not visible in Developer console.

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
protected Intent prepareIcsFeedbackIntent(Activity activity, PackageManager packageManager) {
    ApplicationErrorReport localApplicationErrorReport = new ApplicationErrorReport();
    localApplicationErrorReport.packageName = activity.getPackageName();

    localApplicationErrorReport.type = 11;
    localApplicationErrorReport.installerPackageName = packageManager.getInstallerPackageName(
            localApplicationErrorReport.packageName);

    return getAppErrortIntent().putExtra(Intent.EXTRA_BUG_REPORT, localApplicationErrorReport);
}

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
protected Intent getAppErrortIntent() {
    Intent localIntent = new Intent(Intent.ACTION_APP_ERROR)
            .addCategory(Intent.CATEGORY_DEFAULT)
            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return localIntent;
}
pixel
  • 24,905
  • 36
  • 149
  • 251
  • 1
    Hey, thanks for finding this! Though if it is not showing up in your console, I'm not sure what good it does you. Sending bug reports into the void isn't going to help them get fixed... :-) – CommonsWare Jul 16 '13 at 10:16
  • Maybe Google is planing to provide such feedback reports, since they removed ability to collect logs... – pixel Jul 16 '13 at 14:55
1

Although it's not exactly the same, you can programmatically invoke a crash-report-dialog:

ApplicationErrorReport report = new ApplicationErrorReport();
report.packageName = report.processName = getApplication()
    .getPackageName();
report.time = System.currentTimeMillis();
report.type = ApplicationErrorReport.TYPE_CRASH;
report.systemApp = false;

ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo();
crash.exceptionClassName = e.getClass().getSimpleName();
crash.exceptionMessage = e.getMessage();

StringWriter writer = new StringWriter();
PrintWriter printer = new PrintWriter(writer);
e.printStackTrace(printer);

crash.stackTrace = writer.toString();

StackTraceElement stack = e.getStackTrace()[0];
crash.throwClassName = stack.getClassName();
crash.throwFileName = stack.getFileName();
crash.throwLineNumber = stack.getLineNumber();
crash.throwMethodName = stack.getMethodName();

report.crashInfo = crash;

Intent intent = new Intent(Intent.ACTION_APP_ERROR);
intent.putExtra(Intent.EXTRA_BUG_REPORT, report);
startActivity(intent);

More information here: http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html

TomTasche
  • 5,448
  • 7
  • 41
  • 67
0

Just re-create that layout on a .xml file and create a Class that extends FragmentActivity (as the Google Hangouts App seems to do) or create a Class that extends DialogFragment to handle its logic.

Oscar Salguero
  • 10,275
  • 5
  • 49
  • 48