1.0.178 • Published 6 months ago

expo-call-detection v1.0.178

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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

1.0.178

6 months ago

1.0.177

6 months ago

1.0.175

6 months ago

1.0.172

6 months ago

1.0.170

6 months ago

1.0.16

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.5

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago