react-native - 如何在whatsapp上发送消息而不使用react-native打开应用程序?
问题描述
有没有办法使用 react-native 在 WhatsApp 上自动发送消息?如果没有,我可以在android上使用桥接吗?
解决方案
你可以使用这样的链接:
export const sendWhatsAppMessage = link => {
if (!isUndefined(link)) {
Linking.canOpenURL(link)
.then(supported => {
if (!supported) {
Alert.alert(
'Please install whats app to send direct message'
);
} else {
return Linking.openURL(link);
}
})
.catch(err => console.error('An error occurred', err));
} else {
console.log('sendWhatsAppMessage -----> ', 'message link is undefined');
}
};
推荐阅读
- zeal - 如何以热情或速度使用 mozila 开发者网络文档?
- xcode10 - 有什么方法可以使用 iOS 15 在高山脉上运行 xcode 10
- java - 在 android 11 中下载 pdf
- python - 如何在 python 环境中从我当前的所有模块创建 python 包?
- sorting - 怎么设计这样
- powershell - 保留最近的 n 个文件并删除其余文件
- c++ - LinkedList 类实现不能将变量声明为抽象类型
- python - 嵌套 Spark 数据帧的联合
- java - 找不到包含 arr 包的选项
- sql-server - 为什么 SQL Server Image 数据类型在 sys.all_columns 中将 max_length 设置为 16