Just start the issue reporter directly from your activity using the launcher builder:
IssueReporterLauncher.forTarget("HeinrichReimer", "android-issue-reporter")
// [Recommended] Theme to use for the reporter. // (See #theming for further information.)
.theme(R.style.Theme_App_Dark)
// [Optional] Auth token to open issues if users don't have a GitHub account// You can register a bot account on GitHub and copy ist OAuth2 token here.// (See #how-to-create-a-bot-key for further information.)
.guestToken("28f479f73db97d912611b27579aad7a76ad2baf5")
// [Optional] Force users to enter an email adress when the report is sent using// the guest token.
.guestEmailRequired(true)
// [Optional] Set a minimum character limit for the description to filter out// empty reports.
.minDescriptionLength(20)
// [Optional] Include other relevant info in the bug report (like custom variables)
.putExtraInfo("Test 1", "Example string")
.putExtraInfo("Test 2", true)
// [Optional] Disable back arrow in toolbar
.homeAsUpEnabled(false)
.launch(this);
How to use (extending IssueReporterActivity)
Just create a new Activity that extends IssueReporterActivity:
publicclassExampleReporterActivityextendsIssueReporterActivity {
// Where should the issues go?// (http://github.com/username/repository)@OverridepublicGithubTargetgetTarget() {
returnnewGithubTarget("username", "repository");
}
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
// [Optional] Auth token to open issues if users don't have a GitHub account// You can register a bot account on GitHub and copy ist OAuth2 token here.// (See #how-to-create-a-bot-key for further information.)setGuestToken("28f479f73db97d912611b27579aad7a76ad2baf5")
// [Optional] Force users to enter an email adress when the report is sent using// the guest token.setGuestEmailRequired(true);
// [Optional] Set a minimum character limit for the description to filter out// empty reports.setMinimumDescriptionLength(20);
}
// [Optional] Include other relevant info in the bug report (like custom variables)@OverridepublicvoidonSaveExtraInfo(ExtraInfoextraInfo) {
extraInfo.put("Test 1", "Example string");
extraInfo.put("Test 2", true);
}
}
Theming
Create a theme extending Theme.IssueReporter theme and set it to the launcher using IssueReporterLauncher.theme(@StyleRes int theme) or declare it in AndroidManifest.xml if you have extended IssueReporterActivity:
请发表评论