在我的应用程序中启动FeedbackActivity,就像在Android Hangouts中一样

时间:2013-05-20 07:51:31

标签: android feedback user-feedback

我想为我的应用启动com.google.android.feedback.FeedbackActivity。就像在环聊应用程序中发生的那样。

有谁知道我需要传递哪些额外内容?

Send feedback for Hangouts

3 个答案:

答案 0 :(得分:2)

所以看起来这是可能的,在开发者控制台中看不到bur报告。

@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;
}

答案 1 :(得分:1)

虽然它不完全相同,但您可以通过编程方式调用崩溃报告对话框:

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);

此处提供更多信息:http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html

答案 2 :(得分:0)

只需在.xml文件上重新创建该布局,然后创建一个扩展FragmentActivity的类(就像Google Hangouts App似乎那样)或创建一个扩展DialogFragment以处理其逻辑的类。