cordova-sms-plugin不要求许可 [英] cordova-sms-plugin not asking for permission

查看:138
本文介绍了cordova-sms-plugin不要求许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我添加此代码,我想我可以使用cordova-sms-plugin

I think I have cordova-sms-plugin working, if I add this

sendSms: function() {
        var number = document.getElementById('numberTxt').value.toString(); /* iOS: ensure number is actually a string */
        var message = document.getElementById('messageTxt').value;
        console.log("number=" + number + ", message= " + message);

        //CONFIGURATION
        var options = {
            replaceLineBreaks: false, // true to replace \n by a new line, false by default
            android: {
                intent: ''  // send SMS with the native android SMS messaging
                //intent: '' // send SMS without opening any other app
            }
        };

        var success = function () { alert('Message sent successfully'); };
        var error = function (e) { alert('Message Failed:' + e); };
        sms.send(number, message, options, success, error);
        //$window.sms.send(number, message, intent, success, error);
    }

然后拿走 INTENT,我的应用程序告诉我用户拒绝许可。文档中有一些关于询问权限的说法,但是当我添加时,它是行不通的。

And taking away the 'INTENT' I have the app telling me the user is denying permission. The docs have something saying about asking permssion but when I add this it doesnt work.

我在哪里或如何请求权限?

Where or how do I ask permission?

推荐答案

修复后,我将其添加到了android.json

Fixed, I added this to the android.json

  {
          "xml": "<uses-permission android:name=\"android.permission.RECEIVE_SMS\" />",
          "count": 1
        },
        {
          "xml": "<uses-permission android:name=\"android.permission.READ_SMS\" />",
          "count": 1
        },
        {
          "xml": "<uses-permission android:name=\"android.permission.SEND_SMS\" />",
          "count": 1
        }

这篇关于cordova-sms-plugin不要求许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆