Hi guys,
Super excited to use the newest SDK (31) to implement sending SMS from the app. On iPhone I was able to implement it very quickly, and the docs were a big help.
However, I’m testing on an actual Android device and am getting an error whenever I go to execute the sendSMSAsync method. The error is as follows:
Encountered an exception while calling native method: Exception occurred while executing exported method sendSMSAsync on module ExpoSMS: null
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:95:55 in <unknown>
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:397:4 in __invokeCallback
- ... 4 more stack frames from framework internals
The device has granted permisson to use the SMS module, but it seems that there is something else blocking the execution. I’d expect the phone’s native SMS app to open up with my prepopulated message body, just like it does for iOS.
Here’s the involved code, which again executes perfectly on iOS:
componentDidMount = async () => {
const isAvailable = await SMS.isAvailableAsync();
if (isAvailable) {
this.setState({isAvailable: true})
const { status } = await Permissions.askAsync(Permissions.SMS)
if (status !== 'granted') {
Alert.alert(`Hey! If you give us permission to send text messages, you can send these tee time details to your playing partners! Go to your phone's settings to enable!`);
return
}
Alert.alert("permission status: ", status);
this.setState({isGranted: true})
}
}
_sendSMS = async () => {
await SMS.sendSMSAsync([], this.props.message).then((result) => {
console.log(result["result"])
this.props.handleResult(result["result"]);
}).catch(err => {
console.log(err)
})
}
The error I reported above is in the terminal, while executing expo start
. It just shows up in the logs.
Any idea what can be going on?
Yes, the Expo app on the android device is the latest, and the CLI is updated as well.