- What is this repository for?
 - How do I get set up?
 - Configure and initialize debugg.it in your project
 - Additional options
 - Licence
 
This is a library-project, which provides a tool to report Android application bugs directly into JIRA / GitHub/ BitBucket Issue Tracker.
You can set up debugg.it as gradle dependency or as a module.
Add these lines to your module's build.gradle file:
repositories {
    jcenter()
}dependencies {
    implementation 'com.mooduplabs:debuggit:1.1.1'
}Clone this repo.
Add this library into your project as module (File -> New -> Import Module).
Add following lines to your app-level build.gradle file:
dependencies {
    compile project(path: ':debuggit')
}debugg.it is delivered with 2 configurations: debug and release.
The debug configuration is not minified by ProGuard. If you want to use this configuration, add configuration parameter to your compile project method and set it to 'debug':
dependencies {
    compile project(path: ':debuggit', configuration: 'debug')
}If your project has many product flavors, you can use this syntax:
    productFlavors {
        staging {
            applicationId "com.example.app.staging"
        }
        production {
            applicationId "com.example.app"
        }
    }
dependencies {
    stagingCompile project(path: ':debuggit', configuration: 'debug')
    productionCompile project(path: ':debuggit', configuration: 'release')
}- Create a class which extends 
Applicationclass - Add newly created application class name into your 
AndroidManifest.xmlfile - Add permissions to 
AndroidManifest.xmlfile - Configure and init debugg.it in 
Applicationclass - Attach debugg.it to 
Activityclass 
This is required so that we can init debugg.it together with application.
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
    }
}If your new class is MyApplication.class:
<manifest … >
  <uses-permission … />
  <uses-permission … />
  <application
    android:name=".MyApplication"
    … >
      <activity … />
      <activity … />
   </application>
</manifest>Add these permissions to AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />In Application class onCreate() method, you have to configure and init debugg.it. There are two things that needs to be configured:
- Service where issues will be reported
 - API for uploading image files and (optionally) audio files
 
debugg.it currently supports BitBucket, GitHub and JIRA.
- 
BitBucket
DebuggIt.getInstance().configureBitbucket("repoName", "ownerName");- where
repoNameis your repository nameownerNameis username of repository owner
 - Enable an issue tracker on the Bitbucket repository that will use debugg.it
 
 - 
GitHub
DebuggIt.getInstance().configureGitHub("repoName", "ownerName");- where
repoNameis your repository nameownerNameis username of repository owner
 
 - 
JIRA
DebuggIt.getInstance().configureJira("host", "projectKey");- where
hosthostname of your JIRA server (e.g.yourcompany.atlassian.net)projectKeyis key of your project
 - If your host don't use SSL use this method:
DebuggIt.getInstance().configureJira("host", "projectKey", false); 
 
debugg.it requires an API where it can send image files and (optionally) audio files. There are 3 available configurations:
- 
AWS S3 Bucket
This configuration uses your AWS S3 bucket (https://aws.amazon.com/s3/) to store image and audio files.
DebuggIt.getInstance().configureS3Bucket("bucketName", "accessKey", "secretKey", "region");- where
bucketNameis a name of your bucketaccessKeyis your user's access keysecretKeyis your user's secret keyregionis a region where your S3 bucket is hosted
 
- where
 
We recommend that you create a separate user for debugg.it via AWS Identity and Access Management (IAM) with Read and Write Access to your S3 bucket.
 
- 
Default API
This configuration uses your backend to send image and audio files.
DebuggIt.getInstance().configureDefaultApi("baseUrl", "uploadImageEndpoint", "uploadAudioEndpoint");- where
baseUrlis a base url of your backend (e.g.https://url-to-backend.com)uploadImageEndpointis an url to endpoint handling image upload (e.g./debuggit/uploadImage)uploadAudioEndpointis an url to endpoint handling audio upload (e.g./debuggit/uploadAudio)
 
 
- 
Custom API
This is an extension of default API configuration. The difference is that you have to handle
uploadImage/uploadAudiorequest and response. You are responsible for communication with your backend, but at the same time you have full control over it.DebuggIt.getInstance().configureCustomApi(apiInterface);- where
apiInterfaceis an interface that has two methods:uploadImageanduploadAudiopublic void uploadImage(String imageData, JsonResponseCallback callback);public void uploadAudio(String audioData, JsonResponseCallback callback);- where
imageData/audioDatais a Base64 encoded bitmap / audio file.callbackis a Base64 encoded bitmap / audio file.
 
 
 
After configuration is done, call at the end:
DebuggIt.getInstance().init();
- Init BitBucket with S3:
 
DebuggIt.getInstance()
        .configureS3Bucket("bucketName", "accessKey", "secretKey", "region");
        .configureBitbucket("repoName", "ownerName");
        .init();- Init GitHub with default API:
 
DebuggIt.getInstance()
        .configureDefaultApi("baseUrl", "uploadImageEndpoint", "uploadAudioEndpoint");
        .configureGitHub("host", "projectKey");
        .init();- Init JIRA with custom API:
 
DebuggIt.getInstance()
        .configureCustomApi(new ApiInterface() {
                            @Override
                            public void uploadImage(String imageData, JsonResponseCallback callback) {
                                // Handle API call to your backend and call onSuccess callback with JSONObject response
                                // callback.onSuccess(response);
                                // If something went wrong, call onFailure callback
                                // callback.onFailure(400, "Could not upload image");
                            }
                            @Override
                            public void uploadAudio(String audioData, JsonResponseCallback callback) {
                                // Handle API call to your backend and call onSuccess callback with JSONObject response
                                // callback.onSuccess(response);
                                // If something went wrong, call onFailure callback
                                // callback.onFailure(400, "Could not upload audio");
                            }
                        })
        .configureJira("host", "projectKey");
        .init();Add these methods in your Activity classes (preferably just in base activity class)
- Add this method to 
onStart(): 
DebuggIt.getInstance().attach(this);
- Add this method to 
onActivityResult(): 
DebuggIt.getInstance().getScreenshotPermission(requestCode, resultCode, data);
public abstract class BaseActivity extends AppCompatActivity {
    @Override
    protected void onStart() {
        super.onStart();
        DebuggIt.getInstance().attach(this);
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        DebuggIt.getInstance().getScreenshotPermission(requestCode, resultCode, data);
    }
}debugg.it allows to record audio notes and add it to bug description. To enable this feature simply add this line to your configuration in Application class:
DebuggIt.getInstance().setRecordingEnabled(true);Ensure you have added RECORD_AUDIO permission in AndroidManifest.xml file:
<uses-permission android:name="android.permission.RECORD_AUDIO" />Copyright 2019 MoodUp Team
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.