1.0.0-rc.4 • Published 5 months ago
react-native-app-state-monitor v1.0.0-rc.4
React Native App State Monitor
🌟 About
A lightweight React Native module that accurately tracks app foreground/background state using native platform lifecycle observers, ensuring reliable app state detection.
✨ Features
- 🔍 Precise app state detection on both Android and iOS
- 🏗️ Uses Android's
ProcessLifecycleOwner
and iOS UIApplication notifications - 🔀 Works correctly with multiple activities and complex app lifecycles
- 🧩 Simple and consistent API
- 📱 Supports React Native ≥ 0.60.0
📦 Installation
npm install react-native-app-state-monitor
# or
yarn add react-native-app-state-monitor
🚀 Usage
import AppStateMonitor from 'react-native-app-state-monitor';
// Check current state
console.log('Current state:', AppStateMonitor.currentState);
// Add state change listener
const unsubscribe = AppStateMonitor.addEventListener((newState) => {
console.log('App state changed to:', newState);
});
📖 Full Documentation
🤝 Contributing
Contributions are welcome! Please read our Contributing Guidelines before getting started.
🐛 Reporting Issues
If you encounter any problems, please open an issue with a clear description of the problem.
💡 Why This Module?
React Native's built-in AppState
has known limitations, particularly on Android. This module provides:
- 🔒 More reliable state detection
- 🔄 Consistent behavior across platforms
- 🛠️ Advanced tracking for multi-activity scenarios
📋 Requirements
- React Native ≥ 0.60.0
- iOS ≥ 10.0
- Android API level ≥ 21
🔒 License
🏢 About Vizbee
Vizbee is transforming fragmented experiences across mobile and streaming devices in a home into one seamless app experience to increase viewer acquisition and monetization.