Customizations

Android SDK

πŸ”§ SDK

Initialise the SDK

Open your preferred development tool and add the following to your main class.

import bugbattle.io.bugbattle.BugBattle;
import bugbattle.io.bugbattle.BugBattleActivationMethod;

This two includes are everything you need.

@Override
protected void onCreate(Bundle savedInstanceState) {
....
BugBattle.initialise("apikey", BugBattleActivationMethod.SHAKE, getApplication());
}

Your API key can be found in the project settings within BugBattle. Possible values for the activation method are NONE, SHAKE andSCREENSHOT.

BugBattle.NONE: No automatic activation.

BugBattle.SHAKE: Activation on device shake.

BugBattle.SCREENSHOT: Activation when user performs a screenshot trigger.

Manually initiate the bug reporting flow

Some situations require more control about the activation of the bug reporting flow. By calling the startBugReporting method, you can simply start the flow manually. In order to also prevent the shake gesture, just initialise the Bugbattle SDK with the activation method NONE.

The following method starts the flow, which is also invoked by the shake gesture. To start the flow use this method:

BugBattle.startBugReporting()

Customer email address

Sets the customer's email address.

BugBattle.setCustomerEmail("[email protected]")

Attach custom data

Sometimes you need to attach custom data to bug reports in order to solve them more quickly. Any simple dictionary can be attached.

try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("key", "value");
BugBattle.attachCustomData(jsonObject);
} catch (JSONException e) {
e.printStackTrace();
}

πŸ₯· Silent bug reports

Bugbattle also features silent bug reports, which can be triggered automatically within the background. You need to pass an email address (of the sender), a description and a priority.

BugBattle.sendSilentBugReport("[email protected]", "Silent", SEVERITY.HIGH)

πŸŽ₯ Replays

Bugbattle Replays offer session replays of the last 60 seconds prior to a bug report. This allows you to gain a better understanding of how a bug occurred. The great thing is that we don't require any further user permissions for the replays.

BugBattle.enableReplay();

🌎 Network logging

Bugbattle allows you to monitor all network requests for a better understanding of what's happening within your web-apps & websites. The feature is currently in BETA. Please enable network logging by calling the following method right after initialising the SDK. We are currently working on Interceptors for OkHttp and Volley.

Manually log your network

For now we only have support manual network logging.

* @param urlConnection URL where the request is sent to
* @param requestType GET, POST, PUT, DELETE
* @param status status of the response (e.g. 200, 404)
* @param duration duration of the request
* @param request Add the data you want. e.g the body sent in the request
* @param response Response of the call. You can add just the information you want and need.
BugBattle.logNetwork(String urlConnection, RequestType requestType, int status, int duration, JSONObject request, JSONObject response)

πŸ•΅οΈ Privacy policy

Enable privacy policy check

Enables the privacy policy check within the bug reporting flow. With this option set to true, users must accept the privacy policy in order to send a bug report.

BugBattle.enablePrivacyPolicy(true)

Privacy policy url

Sets the privacy policy url. This is especially handy if you have any special requirements regarding the privacy policy. The default url is set to the Bugbattle privacy policy.

BugBattle.setPrivacyPolicyUrl("https://awesomeproject.com/privacypolicy")

πŸ’¬ Language

Sets the default language of the BugBattle reporting flow. Overrides the system default language. The parameter is formatted as Alpha-2 code. https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes​

Supported languages are:

  • en

  • fr

  • it

  • es

  • de

  • cs

BugBattle.setLanguage("en");

πŸ–₯ Self-Hosted

API url

Sets the API url to your internal BugBattle server. Please make sure that the server is reachable within the network.

BugBattle.setApiUrl("https://internalbugbattle.server")