@mwambacodes/expo-telephony
v0.0.3
Published
A robust Expo module for Android Telephony (SMS, Calls, USSD) and background services.
Maintainers
Readme
expo-telephony
A robust Expo module for managing Android Telephony features (SMS, Calls, USSD) and maintaining a persistent background service.
Features
- SMS: Send and Receive SMS (via BroadcastReceiver).
- Calls: Detect missed calls.
- USSD: Send USSD requests and receive responses (Android O+).
- Background Service: Persistent Foreground Service with customizable notifications.
Installation
npm install expo-telephonyAndroid Configuration
This module handles most of its configuration automatically via Manifest Merging. However, you must ensure you request the necessary permissions at runtime in your application.
Permissions used:
RECEIVE_SMS,READ_SMS,SEND_SMSREAD_CALL_LOGCALL_PHONEFOREGROUND_SERVICE,FOREGROUND_SERVICE_DATA_SYNCPOST_NOTIFICATIONS
Usage
import ExpoTelephony from 'expo-telephony';
// Start the background service
await ExpoTelephony.startService("Gateway is Monitoring");
// Send an SMS
await ExpoTelephony.sendSms("+1234567890", "Hello from Expo!");
// Exec USSD
const response = await ExpoTelephony.sendUssd("*149*01#");
// Events
import { DeviceEventEmitter } from 'react-native';
DeviceEventEmitter.addListener('SmsReceived', (event) => {
console.log("New SMS:", event.body, "from", event.originatingAddress);
});License
MIT
