android-issue-reporter

Additional

Language
Java
Version
1.4.2 (Jan 11, 2024)
Created
Apr 4, 2016
Updated
Jan 11, 2024
Owner
Jan Heinrich Reimer (heinrichreimer)
Contributors
Jan Heinrich Reimer (heinrichreimer)
Paolo Rotolo (paolorotolo)
Karim Abou Zeid (kabouzeid)
Domenico Rotolo (rotolonico)
Patrick Arminio (patrick91)
Tomer Rosenfeld (rosenpin)
Oliver Nitzschke (pinpong)
bubobu
James Fenn (fennifith)
Jhonatas Machado (jhonatasrm)
kleiren
Niko Diamadis (cyb3rko)
Riccardo Busetti (iambriccardo)
D4rK (D4rK7355608)
14
Activity
Badge
Generate
Download
Source code

Advertisement

android-issue-reporter

Is your mailbox full of bug reports and feature requests from your app users?
android-issue-reporter is a new material designed library to report issues from your app directly to GitHub, even without an account.

This library is inspired by Paolo Rotolo's Gitty Reporter

Demo

Download the demo app from the Google Play Store.

Screenshots

GitHub bot Include device info Demo

Installation

Add the android-issue-reporter dependency to your app's build.gradle (or build.gradle.kts):

Groovy DSL
dependencies {
    implementation 'com.github.heinrichreimer:android-issue-reporter:1.4.2'
}
Kotlin DSL
dependencies {
    implementation("com.github.heinrichreimer:android-issue-reporter:1.4.2")
}

Then, add the JitPack repository in your root settings.gradle (or settings.gradle.kts):

Groovy DSL
dependencyResolutionManagement {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
Kotlin DSL
dependencyResolutionManagement {
    repositories {
        maven(url = "https://jitpack.io")
    }
}

Check out the latest dependency android-issue-reporter from jitpack.io.

Usage

Launch from anywhere with IssueReporterLauncher

Just start the issue reporter directly from your activity using the fluent launcher builder:

Java
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 address 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 the back arrow in the toolbar
        .homeAsUpEnabled(false)
        .launch(this);
Kotlin
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 address 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 the back arrow in the toolbar
        .homeAsUpEnabled(false)
        .launch(this)

Extending IssueReporterActivity

Alternatively, if you need to further customize the issue reporter, create a new Activity class that extends IssueReporterActivity:

Java
public class ExampleReporterActivity extends IssueReporterActivity {
    // Where should the issues go?
    // (http://github.com/username/repository)
    @Override
    public GithubTarget getTarget() {
        return new GithubTarget("username", "repository");
    }
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // [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)
    @Override
    public void onSaveExtraInfo(ExtraInfo extraInfo) {
        extraInfo.put("Test 1", "Example string");
        extraInfo.put("Test 2", true);
    }
}
Kotlin
class ExampleReporterActivity : IssueReporterActivity() {
    // Where should the issues go?
    // (http://github.com/username/repository)
    override fun getTarget(): GithubTarget {
        return GithubTarget("username", "repository")
    }
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // [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)
    override fun onSaveExtraInfo(extraInfo: ExtraInfo) {
        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:

<style name="Theme.App" parent="Theme.IssueReporter">
    <item name="colorPrimary">...</item><!-- required -->
    <item name="colorPrimaryDark">...</item><!-- required -->
    <item name="colorAccent">...</item><!-- required -->
</style>

Creating a GitHub bot key

  1. Create a new GitHub account. (You have to use a unique email address.)

  2. Go to https://github.com/settings/tokens and create a new token using Generate new token. (Only the public_repo permission is needed.)

  3. Copy the OAuth access token you get at the end of the setup.

  4. Use the token in IssueReporterLauncher.theme(String token) or override getGuestToken() in your reporter activity like this:

    Java
    @Override
    public String getGuestToken() {
        return "<your token here>";
    }
    Kotlin
    override fun getGuestToken(): String {
        return "<your token here>"
    }

Known Limitations

  • Two factor authentication is not supported.

Development

To contribute to the android-issue-reporter library, just create a codespace from this repository or clone it in an editor that supports Dev Containers (e.g., Visual Studio Code or IntelliJ). All required dependencies will automatically be installed for you.
Once ready, create a pull request with your changes. We're happy to any contribution!

Support

If you hit any problems using android-issue-reporter, please file an issue. We're happy to help!

License

This repository is released under the MIT license. If you like android-issue-reporter, consider sponsoring me.