Code Monkey home page Code Monkey logo

buglife-android's Introduction

Documentation Twitter

Buglife is an awesome bug reporting SDK & web platform for Android apps. Here's how it works:

  1. User takes a screenshot, or stops screen recording
  2. User annotates their screenshot & writes feedback
  3. Bug reports are pushed to your team's email/Jira/Slack/Asana/wherever you track bugs.

You can also find Buglife for iOS here.


Main Features
πŸ‘€ Free + no account required
πŸ“– Open source
πŸƒπŸ½β€β™€οΈ Fast & lightweight
🎨 Themeable
πŸ“© Automatic caching & retry
πŸŽ₯ Screen recording
πŸ“œ Custom form fields, with pickers & multiline text fields
ℹ️ Advanced logging, with debug / info / warning levels
πŸ“Ž Custom attachments, including JSON & SQLite support

Installation

  1. Add buglife-android as a dependency to your app's build.gradle.

    dependencies {
    	implementation 'com.buglife.sdk:buglife-android:1.5.1'
    }
  2. Create an Application subclass in your project if you don't already have one. (And don't forget to add it to your app's AndroidManifest.xml.)

  3. Add the following lines to the end of the onCreate() method in your app's Application subclass:

    Buglife.initWithEmail(this, "[email protected]");
    Buglife.setInvocationMethod(InvocationMethod.SCREENSHOT);

    Be sure to replace [email protected] with your own email address; this is where bug reports will be sent to.

    Got an account?

    If you have a Buglife account already, you should initialize Buglife with your team's API key instead of your email:

    Buglife.initWithApiKey(this, "YOUR_API_KEY");
    Buglife.setInvocationMethod(InvocationMethod.SCREENSHOT);
  4. Build & run on a device; take a screenshot to report a bug!

  5. Submit a bug report from your device, then check your email for a link to the Buglife web dashboard!

Usage

Invocation

There are 2 different ways to invoke the bug reporter, enumerated by Buglife.InvocationMethod:

  1. SHAKE: Invokes when the user shakes their device.

    Buglife.setInvocationMethod(InvocationMethod.SHAKE);
  2. SCREENSHOT: Invokes when the user manually takes a screenshot with their device.

    Buglife.setInvocationMethod(InvocationMethod.SCREENSHOT);
  3. NONE: Disables all except manual invocations.

    Buglife.setInvocationMethod(InvocationMethod.NONE);

    This may be preferable for production builds. In this case, we recommend embedding a hidden button somewhere in your app which manually presents the bug reporter, so that you can still collect logs & other information.

For both automatic invocations (SHAKE and SCREENSHOT), a screenshot of the current activity is captured & attached to the bug report draft.

We recommend using the screenshot invocation for most apps. Taking screenshots to report feedback comes naturally to most users, and screenshots are still saved to the user's device as expected.

Manual & Custom Invocations

You can manually present the bug reporter activity using:

Buglife.showReporter();

Unlike the SHAKE & SCREENSHOT invocations, manually presenting the bug reporter activity does not automatically capture & attach a screenshot to the bug report draft.

This is useful for situations where attaching a screenshot of the immediate application state doesn't make sense (for example, if you have a "Report Bug" option in your app's settings screen).

Manually capture & attach screenshots

You can capture a screenshot of your app at any moment using Buglife.getScreenshotBitmap(). You can then create an Attachment object from the generated bitmap, and add this to your bug report draft using the Buglife.addAttachment() method. For example:

// Capture a screenshot of the current activity
Bitmap screenshot = Buglife.getScreenshotBitmap();
// Create an Attachment object with the generated screenshot
Attachment attachment = new Attachment
		.Builder("Screenshot.png", Attachment.TYPE_PNG)
		.build(screenshot);
// Queue the Attachment for the next bug report draft
Buglife.addAttachment(attachment);
// Show the bug reporter activity. This will include the queued attachment
Buglife.showReporter();

User Identification

If your application stores a user’s email address, then typically you should simply set the user’s email address shortly after initializing Buglife:

String email = /** Current user's email */
Buglife.setUserEmail(email);

Alternatively, you may set a string representing the user’s name, database ID or other identifier:

String username = /** Current username */
Buglife.setUserIdentifier(username);

User Location

By default, if your app is granted location permissions, Buglife will include that location in the report. This is useful for tracking down location-relevant bugs, such as services that are erroneously offered or not offered based on location.

You can change this behavior with the following:

Buglife.setCollectLocationIfPossible(false);

If the app does not request a location permission or the user denies the request, Buglife will not collect or include location data.

Custom Attributes

Adding custom attributes

You can include custom attributes (i.e. key-value pairs) to your bug reports, as such:

Buglife.putAttribute("Artist", "2Pac");
Buglife.putAttribute("Song", "California Love");

Removing attributes

To clear an attribute, set its value to null.

Buglife.putAttribute("Artist", null);

Screen Recording

Buglife can be used to record a user's screen, and attach the recording to a bug report. Screen recording is initiated programmatically, like such:

Buglife.startScreenRecording();
Here's how the complete screen recording flow works:
  1. The screen recording flow is initiated using Buglife.startScreenRecording();
  2. The user is shown an OS-level prompt requesting permission to record the screen.
  3. Once granted, Buglife immediately begins recording the screen.
  4. Screen recording will progress for up to 30 seconds. If the user wishes to stop screen recording earlier, they may do so by tapping the floating Record button.
  5. The Buglife reporter UI is automatically shown with the recording attached.

Learn more

Check out the Buglife Android guide for configuration & customization options.

License

Copyright (C) 2017-2019 Buglife, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0
    
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.