-
Notifications
You must be signed in to change notification settings - Fork 165
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
Multiple recipients problem #25
Comments
hey @spyjo, could you try to use an array instead please:
let me know if it works. the string parameter should work though, I need to look into it. |
Should it work as a string though? I see no reason to support that. It makes sense to me that it should either be a single number as a string, or an array of strings. |
I tried with an array but it's the same result, only the first number receive the message I added a debug line in www/sms.js in send():
and the result is:
so the array of phone numbers is ok on the javascript side before being sent to the java function |
@Aharris88, I don't think it makes sense to maintain that neither. @spyjo, I can confirm the issue. I will look into it. |
the issue comes from here https://github.com/cordova-sms/cordova-sms-plugin/blob/master/src/android/Sms.java#L139 we need to iterate over the list of numbers and call http://developer.android.com/reference/android/telephony/SmsManager.html#sendTextMessage(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent) for each. |
That raises some questions about the plugin behavior and consistency. if you use the plugin with intent = "INTENT" and phones = ['number1', 'number2'], it is sending only one group message (like iOS) but if intent = "" and phones = ['number1', 'number2'], it would send 2 separate messages, so inconsistency here. IMHO, we should clearly explain the difference between a group message and a simple message to several recipients. Also explain that group messages are not available within the current intent (unless if there is a solution that I don't know). @Aharris88, thoughts? |
Ok thank you for looking into it :) |
I think it should be consistent. So it could be that sending an array of numbers with or without intent, should send a group message. But if you send an array of numbers without intent, maybe you could set an option to send them individually. |
Sending a group message without intent is "impossible" (I haven't found anything online about it yet) @spyjo, what is your use case here? Group message or n times the same message? |
I need to send the same message to a list of contacts, without showing the default sms app, and then display one confirmation that all messages are sent. |
To update this issue, for now I have fixed my problem with a "for" on each number to send messages, counting error and success, and detect when I received the last callback (total success+errors = total numbers) to display my popup "SMS are sent". For your previous question, I can confirm I do not want to send a group message, but anyway if you need it in your plugin I think that in the android dev documentation the right function is sending an MMS with sendMultimediaMessage() which seems to allow multiple recipients in group. |
@spyjo that's definitely what you should you for now. what we should do here:
|
Closing this one, it will be managed in #14 |
how to solve same issue in ios, only message is sent to first number only. |
Hello,
I have a problem with sending SMS to multiple recipients, I tried with separating with , or ; but only the first number listed is receiving the message in both cases.
Here is the code:
I tried on Android 4.4 or Android 5.0
Is there something else I can try or is this a bug ?
Thank you
The text was updated successfully, but these errors were encountered: