Giter VIP home page Giter VIP logo

Comments (7)

jerems6 avatar jerems6 commented on September 26, 2024 3

Try to check the permission before calling the sendSMS function. I am using react-native-permissions:

Permissions.checkMultiple(['readSms', 'receiveSms']).then((response) => {
    if (response.readSms == 'authorized' && response.receiveSms == 'authorized')
        this.sendMessage(); // Your function call
    else
        Permissions.request('readSms').then((response) => {
            if (response == 'authorized')
            Permissions.request('readSms').then((response) => {
                    if (response == 'authorized')
                        this.sendMessage(); // Your function call
                });
        });
});

from react-native-sms-x.

damisadam avatar damisadam commented on September 26, 2024 1

Try to check the sendSMS permission before calling the sendSMS function. I am using react-native-permissions:
sendSMSFunction() {

    Permissions.checkMultiple(['readSms', 'sendSms']).then((response) => {
        if (response.readSms == 'authorized' && response.sendSms == 'authorized')
            this.sendMessage(); // Your function call
        else
            Permissions.request('readSms').then((response) => {
                if (response == 'authorized')
                    Permissions.request('sendSms').then((response) => {
                        if (response == 'authorized')
                            this.sendMessage(); // Your function call
                    });
            });
    });


}

This code working fine for me.

from react-native-sms-x.

massivebrains avatar massivebrains commented on September 26, 2024

+1

from react-native-sms-x.

massivebrains avatar massivebrains commented on September 26, 2024

Hello @sabatsu have you been able to solve this issue?

from react-native-sms-x.

massivebrains avatar massivebrains commented on September 26, 2024

wow @jerems6 i figured i need the 'readSms' permission on andriod > 6.0

Thanks so much

from react-native-sms-x.

TamasNeumer avatar TamasNeumer commented on September 26, 2024

Try to check the sendSMS permission before calling the sendSMS function. I am using react-native-permissions:
sendSMSFunction() {

    Permissions.checkMultiple(['readSms', 'sendSms']).then((response) => {
        if (response.readSms == 'authorized' && response.sendSms == 'authorized')
            this.sendMessage(); // Your function call
        else
            Permissions.request('readSms').then((response) => {
                if (response == 'authorized')
                    Permissions.request('sendSms').then((response) => {
                        if (response == 'authorized')
                            this.sendMessage(); // Your function call
                    });
            });
    });


}

This code working fine for me.

I don't know what kind of dark magic you got going on there but sendSms is not even a supported type in react-native-permissions... readSms and receiveSms are supported. I managed to get readSms authorised, but using react-native-permissions when requesting permission for receiveSms I didn't get any kind of pop-up window etc. (It simply remained restricted)

Anyway in the end I ended up with the Snding SMS message: uid 10216 does not have android.premission.SEND_SMS. error message...

from react-native-sms-x.

Masafir avatar Masafir commented on September 26, 2024

Use 'granted' on android and not 'authorized'

from react-native-sms-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.