我想com.google.android.feedback.FeedbackActivity
为我的应用程序启动。就像它发生在环聊应用程序中一样。
有谁知道我需要通过哪些附加功能才能这样做?
我想com.google.android.feedback.FeedbackActivity
为我的应用程序启动。就像它发生在环聊应用程序中一样。
有谁知道我需要通过哪些附加功能才能这样做?
所以看起来这是可能的,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;
}
虽然不完全相同,但您可以通过编程方式调用崩溃报告对话框:
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
只需在 .xml 文件上重新创建该布局并创建一个扩展 FragmentActivity 的类(就像 Google Hangouts 应用程序似乎所做的那样)或创建一个扩展 DialogFragment 的类来处理其逻辑。