SMS插件无法在ionic 4和应用程序中工作?

问题描述 投票:-2回答:2

我正在尝试使用sms插件来发送sms,但是每当我尝试发送sms并且sms.hasPermission()始终为false时,它总是崩溃。请让我知道如何请求短信许可并发送短信? 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");
          }
        })
android cordova sms cordova-plugins ionic4
2个回答
0
投票

https://ionicframework.com/docs/native/android-permissions的正确实现

强烈建议您在android ionic项目上访问任何本机功能。


0
投票

离子SMS插件可能有问题,所以我从https://github.com/akashpjames/smsApp/blob/master/src/app/tab1/tab1.page.ts那里获得了参考,并且工作正常

© www.soinside.com 2019 - 2024. All rights reserved.