<commit_before># NotifiBug Library for Android

[ ![Download](https://api.bintray.com/packages/cheesecakelabs/maven/NotifiBug/images/download.svg) ](https://bintray.com/cheesecakelabs/maven/NotifiBug/_latestVersion)

It does what every bug client needs to do but little earlier and in a smarter way

## How to use it

Below is an example of how to register NotifiBug library to handle uncaught exceptions of you app and send 
crash reports to NotifiCrash service.

### Permissions in manifest

The `AndroidManifest.xml` requires the permission `android.permission.INTERNET` and would like the permission `android.permission.ACCESS_NETWORK_STATE` even though optional.

```xml
<!-- REQUIRED to send captures to NotifiCrash service -->
<uses-permission android:name="android.permission.INTERNET" />

<!-- OPTIONAL but makes NotifiBug smarter -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

### Init library in your project

``` java
public class MainActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		// NotifiBug will look for uncaught exceptions from previous runs and send them
		NotifiBug.init(this.getApplicationContext(), "YOUR_SERIAL_NUMBER");

	}

}
```

### Capture a message

``` java
    NotifiBug.captureMessage("Something significant may have happened");
```

### Set a listener to intercept the NotifiBugEventBuilder before each capture

``` java
// CALL THIS BEFORE CALLING NotifiBug.init()
// Sets a listener to intercept the NotifiBugEventBuilder before
// each capture to set values that could change state
NotifiBug.setCaptureListener(new NotifiBugEventCaptureListener() {

	@Override
	public NotifiBugEventBuilder beforeCapture(NotifiBugEventBuilder builder) {

		// Needs permission - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
		ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
		NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

		// Sets extra key if wifi is connected
		try {
			builder.getExtra().put("wifi", String.valueOf(mWifi.isConnected()));
			builder.getTags().put("tag_1", "value_1");
		} catch (JSONException e) {}

		return builder;
	}

});

```

## Authors and Contributors

Edited for NotifiCrash by <NAME> (@marsicdev)

This is refactored and optimised [Sentry for Android](https://github.com/joshdholtz/Sentry-Android) library.
Credits for most of the code goes to @joshdholtz

## Support or Contact

Having trouble with NotifiBug? Check out the [javadocs]() or contact <EMAIL> and we’ll help you out.

## License

NotifiBug is available under the MIT license. See the [LICENSE](https://github.com/CheesecakeLabs/AndroidNotifiBug/blob/master/LICENSE) file for more info.<commit_msg>Updating README with grade dependency and License shield<commit_after># NotifiBug Library for Android

[![Download](https://api.bintray.com/packages/cheesecakelabs/maven/notifibug/images/download.svg)](https://bintray.com/cheesecakelabs/maven/notifibug/_latestVersion)
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://www.opensource.org/licenses/MIT)
It does what every bug client needs to do but little earlier and in a smarter way

## Setup

Releases are published to [bintray jcenter](https://bintray.com/bintray/jcenter) (package appear immediately after release)

Gradle:

```groovy
compile 'io.ckl.notifibug:notifibug:0.1.0-snapshot'
```

## How to use it

Below is an example of how to register NotifiBug library to handle uncaught exceptions of you app and send 
crash reports to NotifiCrash service.

### Permissions in manifest

The `AndroidManifest.xml` requires the permission `android.permission.INTERNET` and would like the permission `android.permission.ACCESS_NETWORK_STATE` even though optional.

```xml
<!-- REQUIRED to send captures to NotifiCrash service -->
<uses-permission android:name="android.permission.INTERNET" />

<!-- OPTIONAL but makes NotifiBug smarter -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

### Init library in your project

``` java
public class MainActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		// NotifiBug will look for uncaught exceptions from previous runs and send them
		NotifiBug.init(this.getApplicationContext(), "YOUR_SERIAL_NUMBER");

	}

}
```

### Capture a message

``` java
    NotifiBug.captureMessage("Something significant may have happened");
```

### Set a listener to intercept the NotifiBugEventBuilder before each capture

``` java
// CALL THIS BEFORE CALLING NotifiBug.init()
// Sets a listener to intercept the NotifiBugEventBuilder before
// each capture to set values that could change state
NotifiBug.setCaptureListener(new NotifiBugEventCaptureListener() {

	@Override
	public NotifiBugEventBuilder beforeCapture(NotifiBugEventBuilder builder) {

		// Needs permission - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
		ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
		NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

		// Sets extra key if wifi is connected
		try {
			builder.getExtra().put("wifi", String.valueOf(mWifi.isConnected()));
			builder.getTags().put("tag_1", "value_1");
		} catch (JSONException e) {}

		return builder;
	}

});

```

## Authors and Contributors

Edited for NotifiCrash by <NAME> (@marsicdev)

This is refactored and optimised [Sentry for Android](https://github.com/joshdholtz/Sentry-Android) library.
Credits for most of the code goes to @joshdholtz

## Support or Contact

Having trouble with NotifiBug? Check out the [javadocs]() or contact <EMAIL> and we’ll help you out.

## License

NotifiBug is available under the MIT license. See the [LICENSE](https://github.com/CheesecakeLabs/AndroidNotifiBug/blob/master/LICENSE) file for more info.
{'fraction_non_alphanumeric': 0.10193779514737014, 'fraction_numerical': 0.0011398794984530207, 'mean_word_length': 5.29948717948718, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 9, 'lorem ipsum': 0, 'www.': 1, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5030663', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1763, 'n_words': 536}