[英]SMS plugin not working in ionic 4 and app?
i'm trying to use sms plugin to send sms but it always crashs whenever i try to send sms and also sms.hasPermission() is always false?我正在尝试使用短信插件发送短信,但每当我尝试发送短信时它总是崩溃,而且 sms.hasPermission() 总是假的? Please let me know how to request sms permission and send sms?请让我知道如何请求短信许可和发送短信? https://ionicframework.com/docs/native/sms https://ionicframework.com/docs/native/sms
this.sms.hasPermission().then(hasPermission => {
console.log("hasPermission",hasPermission);
if(hasPermission){
this.sms.send(i.phoneNumber, message, {
replaceLineBreaks: false, // true to replace \n by a new line, false by default
android: {
intent: 'INTENT' // send SMS with the native android SMS messaging
//intent: '' // send SMS without opening any other app
}
});
} else{
console.log("eror");
}
})
correct implementation of https://ionicframework.com/docs/native/android-permissions正确实现https://ionicframework.com/docs/native/android-permissions
prior accessing any native functionality on android ionic project is highly recommended.强烈建议在访问 android 离子项目上的任何本机功能之前。
Ionic SMS plugin might have some issue so i have taken reference from https://github.com/akashpjames/smsApp/blob/master/src/app/tab1/tab1.page.ts and it's working fine离子短信插件可能有一些问题,所以我参考了https://github.com/akashpjames/smsApp/blob/master/src/app/tab1/tab1.page.ts它工作正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.