Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin should use CordovaInterface.getThreadPool(). #192

Closed
demobiel opened this issue Mar 7, 2019 · 5 comments
Closed

Plugin should use CordovaInterface.getThreadPool(). #192

demobiel opened this issue Mar 7, 2019 · 5 comments

Comments

@demobiel
Copy link

demobiel commented Mar 7, 2019

When I try to run sms.requestPermission() I got immediately the error callback. I am never asked if I would allow to send SMS or not.

I run the following code:

requestSMSPermission: function() {
        var success = function (hasPermission) { 
            if (!hasPermission) {
                alert("about to ask for permission");
                sms.requestPermission(function() {
                    alert('[OK] Permission accepted')
                }, function(error) {
                    alert('[WARN] Permission not accepted')
                    // Handle permission not accepted
                })
            }
        };
        var error = function (e) { alert('Something went wrong:' + e); };
        sms.hasPermission(success, error);
    }

And so I get an alert "about to ask permission", and immediately "[Warn] Permission not accepted".

I followed all the tips on this issue: #189,
but no success.

When I inspect the catlog, I see the following line:
03-07 10:14:43.963 6498 6605 W PluginManager: THREAD WARNING: exec() call to Sms.request_permission blocked the main thread for 41ms. Plugin should use CordovaInterface.getThreadPool().

I am using cordova 7.1.1 and latest version of the plugin.

Kind regards
Andries

@demobiel demobiel closed this as completed Mar 7, 2019
@demobiel demobiel reopened this Mar 7, 2019
@dbaq
Copy link
Member

dbaq commented Mar 7, 2019

hey @demobiel,

Thanks for reporting the issue. Feel free to contribute, it should be fairly easy to implement.

@dbaq dbaq self-assigned this Mar 7, 2019
@demobiel
Copy link
Author

demobiel commented Mar 7, 2019

Hi dbaq,

I think I actually reported 2 issues:
first: sms.requestPermission(success, error) always calls error in my case

because of that I looked into the log and saw this error, but apparently it is only a warning.

I think I can solve the second one, and I am willing to contribute, however I have no idea why this falls down each time to error.

Adding the intent into the manifest works, but of course this will not get it on the Google store...

@vvpolyakov
Copy link

I tried all possible versions of SDK and Phonegap versions, as well as different phones, and constantly get an error "User has denied permission"
This error returns both sms.requestPermission() and sms.send()
Plugin version 1.0.0
I'm testing mostly on Android 7.0
Compile through Phonegap Build service
Can anyone have a working example?

@dbaq
Copy link
Member

dbaq commented Mar 21, 2019

I don't know about phonegap.

Have you read #183?

The only recent change is this commit: ecf4d09

@dbaq
Copy link
Member

dbaq commented May 29, 2019

To make it work with PhoneGap, you need to add the SEND_SMS permission manually if you are using android: { intent: '' }:

See #198

@dbaq dbaq closed this as completed May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants