Last active
December 21, 2015 14:28
-
-
Save jayeshcp/6319423 to your computer and use it in GitHub Desktop.
Android: Sending App Feedback from within App itself
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Open Android's standard Feedback screen for users to send app feedback | |
* Create options menu, and on its click event call following method. | |
* Show this menu item, only if Build version is greater than or equal | |
* to ICE_CREAM_SANDWICH (4.0) | |
*/ | |
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) | |
private void OpenFeedbackForm() { | |
// Check if Build is higher than or equal to Ice Cream Sandwich (4.0) | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { | |
try { | |
ApplicationErrorReport report = new ApplicationErrorReport(); | |
report.packageName = report.processName = getApplication().getPackageName(); | |
report.time = System.currentTimeMillis(); | |
report.type = ApplicationErrorReport.TYPE_NONE; // TYPE_NONE to be used for general reporting. | |
// This can be changed to TYPE_CRASH to send crash report. | |
// However above change requires this code to be placed in | |
// Exception catch block ! | |
report.systemApp = false; | |
// This ensures Android opens selection box for | |
// sending bug report (which is intended functionality) | |
Intent intent = new Intent(Intent.ACTION_APP_ERROR); | |
intent.putExtra(Intent.EXTRA_BUG_REPORT, report); | |
startActivity(intent); | |
} catch (Exception e) { | |
//Log.e(TAG, e.toString()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment