An open API service indexing awesome lists of open source software.

https://github.com/mehcode/rn-device-activity

Device Activity Events for React Native (iOS and Android)
https://github.com/mehcode/rn-device-activity

Last synced: 11 months ago
JSON representation

Device Activity Events for React Native (iOS and Android)

Awesome Lists containing this project

README

          

# React Native Device Activity
> Device Activity Events for React Native (iOS and Android)

## Install

```
npm i rn-device-activity --save
```

## Configure

```
react-native link rn-device-activity
```

## Usage

```js
import {DeviceEventEmitter} from "react-native";

function handleResume() {
// called on resume of app
}

function handlePause() {
// called on pause of app
}

function handleDestroy() {
// called on destroy of app
}

// Resume / Pause
DeviceEventEmitter.addListener("deviceResume", handleResume);
DeviceEventEmitter.addListener("devicePause", handlePause);

// Android ONLY
DeviceEventEmitter.addListener("deviceDestroy", handleDestroy);
```