expo-call-detection v1.0.178
Expo Call Detection
This Expo plugin allows you to detect the call state in your React Native application.
Installation
npx expo install expo-call-detection
Configuration
Add the plugin to your app.config.js
or app.json
file:
{
"plugins": [
"expo-call-detection"
]
}
Usage
import React, { useEffect } from 'react';
import { startCallDetection, stopCallDetection, addCallStateListener } from 'expo-call-detection';
import { Text, View } from 'react-native';
export default function App() {
useEffect(() => {
async function startDetection() {
try {
await startCallDetection();
} catch (error) {
console.error("Failed to start call detection:", error);
}
}
startDetection();
const subscription = addCallStateListener((event) => {
console.log("Call State Changed:", event);
});
return () => {
subscription?.remove();
stopCallDetection();
};
}, []);
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Call Detection Example</Text>
</View>
);
}
API Reference
startCallDetection()
Starts the call detection service. Returns a promise that resolves with a boolean indicating success.
stopCallDetection()
Stops the call detection service. Returns a promise that resolves with a boolean indicating success.
addCallStateListener(callback)
Adds a listener for call state changes. The callback function will be called with an event object containing the call state. Returns a subscription object that can be used to remove the listener.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago