expo-call-detector
v0.1.0
Published
Simple module to detect calls inside your expo app
Maintainers
Readme
expo-call-detector
Detect phone call states in your Expo app.
Installation
npx expo install expo-call-detectorAPI
useCallDetector()
Hook that automatically starts call detection and manages state.
import { useCallDetector } from "expo-call-detector";
import ExpoCallDetectorModule from "expo-call-detector";
import { useEffect } from "react";
export default function App() {
const { isCallActive, isReady } = useCallDetector();
useEffect(() => {
ExpoCallDetectorModule.requestPermission();
}, []);
return <Text>{isCallActive ? "On Call" : "No Call"}</Text>;
}Manual Control
import ExpoCallDetectorModule from "expo-call-detector";
// Check/request permission
const hasPermission = await ExpoCallDetectorModule.checkPermission();
const permission = await ExpoCallDetectorModule.requestPermission();
// Start/stop listening
await ExpoCallDetectorModule.startListening();
await ExpoCallDetectorModule.stopListening();
// Listen to events
const subscription = ExpoCallDetectorModule.addListener(
"onCallStateChanged",
(event) => {
console.log("Call active:", event.isActive);
}
);Permissions
Android
The READ_PHONE_STATE permission is automatically added by this module. Users will need to grant permission at runtime using the requestPermission() method.
iOS
No special permissions required. Uses CallKit for call state detection.
Example
See the example directory for a complete implementation.
Author
Daksh | Github | Website | Twitter
License
MIT
