# react-native-crasheye

> react native crasheye module

Latest version **0.2.1** (published 2017-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-crasheye
pnpm add react-native-crasheye
yarn add react-native-crasheye
bun add react-native-crasheye
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2017-02-27 |
| First published | 2017-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | cooclsee |
| Maintainers | cooclsee |
| Keywords | react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-crasheye
- Repository: https://github.com/cooclsee/react-native-crasheye
- Issues: https://github.com/cooclsee/react-native-crasheye/issues
- npm.io page: https://npm.io/package/react-native-crasheye

## Recent versions

- 0.2.1 (latest) — 2017-02-27
- 0.2.0 — 2017-02-27
- 0.1.0 — 2017-02-24
- 0.0.1 — 2017-02-24

## README

# react-native-crasheye

[![NPM](https://nodei.co/npm/react-native-crasheye.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/react-native-crasheye/)

## Introduction

Crasheye react native module.

Base on:

- Crasheye Android SDK 2.2.1
- Crasheye iOS SDK 2.5.1

More infomation: [http://www.crasheye.cn/sdk](http://www.crasheye.cn/sdk)

## Getting started

`$ npm install react-native-crasheye --save`

### Mostly automatic installation

`$ react-native link react-native-crasheye`

> You should add crasheye SDK to your iOS project. Official tutorial is [here](http://www.crasheye.cn/help/iosskduse#overview-ios-sdk).

### Manual installation


#### iOS

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-crasheye` and add `RNCrasheye.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNCrasheye.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Add crasheye SDK to your iOS project. Official tutorial is [here](http://www.crasheye.cn/help/iosskduse#overview-ios-sdk).
5. Run your project (`Cmd+R`)

#### Android

1. Open up `android/app/src/main/java/[...]/MainActivity.java`
  - Add `import com.cooclsee.crasheye.RNCrasheyePackage;` to the imports at the top of the file
  - Add `new RNCrasheyePackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
  	```
  	include ':react-native-crasheye'
  	project(':react-native-crasheye').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-crasheye/android')
  	```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
  	```
      compile project(':react-native-crasheye')
  	```


## Usage

### Import
```javascript
import Crasheye from 'react-native-crasheye';
```

### Initialize SDK
```javascript
Crasheye.init({
	appKey: 'your appKey', // required
	channelID: '', // option
	appVersion: '', // option
	flushOnlyOverWiFi: false, // default false
	userIdentifier: '', // option
	logging: {
		lines: 1000, // option, less than 1000
		filter: '', // option
	}
});
```

### Get SDK Version
```javascript
Crasheye.getSDKVersion()
  .then(ver => console.log(ver));
// or
let ver = await Crasheye.getSDKVersion();
```

### Get Device ID
```javascript
Crasheye.getDeviceId()
  .then(deviceId => console.log(deviceId));
// or
let deviceId = await Crasheye.getDeviceId();
```

### Add Breadcrumb
```javascript
Crasheye.leaveBreadcrumb('the breadcrumb content');
```

### Send Exception
```javascript
Crasheye.sendScriptException('errorTitle', 'exception content');
```

### Add Extra Data
```javascript
Crasheye.addExtraData('key', 'value');
```

---
_Source: https://npm.io/package/react-native-crasheye · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
