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)
- Host: GitHub
- URL: https://github.com/mehcode/rn-device-activity
- Owner: mehcode
- License: mit
- Created: 2016-07-30T09:06:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-06T14:55:43.000Z (about 9 years ago)
- Last Synced: 2025-03-24T20:43:04.049Z (11 months ago)
- Language: Java
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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);
```