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

If is passed something vars on success callback it is called everytime (also on error) #62

Closed
trippo opened this issue Nov 24, 2015 · 6 comments

Comments

@trippo
Copy link

trippo commented Nov 24, 2015

If i pass something in the success callback it is called everytime also when there is an error.

example:

sms.send(data.phoneNumber, text, options, success(data), error );

success(data) is called also when there is an error...

@trippo trippo changed the title If you pass something vars on success callback it is called everytime (also on error) If is passed something vars on success callback it is called everytime (also on error) Nov 24, 2015
@netbuffer
Copy link

And that ’ s happened to me

@dbaq
Copy link
Member

dbaq commented Dec 12, 2015

which platform, which version of cordova? can you also share some code pls?

@trippo
Copy link
Author

trippo commented Dec 14, 2015

In last version of cordova on android 4.
Es. in a for cycle to send 10 sms i want to update the state of "to send sms".

var error = function(id){
//set id message to error
}
var success = function (id) {
//set id message to sent
}
for ...
sms.send(phoneNumber, message, options, success(id), error(id) );

@ghost
Copy link

ghost commented Jan 17, 2016

For android It is passing success even if the user cancels out and dose not sent SMS...i wrote a post on how to use this with ionic see code here
http://pointdeveloper.com/how-to-send-an-sms-with-ionic-framework-and-ngcorodva/

i have tested it in Android 4.1 and 5 with 'INTENT' also without it.

Does the success call back refer to sending of SMS or just that the SMS app has been passed the data?

@dbaq
Copy link
Member

dbaq commented Jan 17, 2016

@pointdeveloper, please see #26.
@trippo I believe, you cannot do what you are doing.

for (...) {
-  sms.send(phoneNumber, message, options, success(id), error(id) );
+  sms.send(phoneNumber, message, options, success, error);
}

You can't pass parameters to the success or error callback functions. Here is a SO post that might help you: http://stackoverflow.com/questions/13003828/javascript-callback-function-with-parameters

@trippo
Copy link
Author

trippo commented Jan 18, 2016

Thanks

@trippo trippo closed this as completed Jan 18, 2016
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