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

Adding Support for MMS #14

Open
christyrajupaul opened this issue Feb 18, 2015 · 84 comments
Open

Adding Support for MMS #14

christyrajupaul opened this issue Feb 18, 2015 · 84 comments

Comments

@christyrajupaul
Copy link

Adding support for MMS. Send MMS via this plugin.

@dbaq dbaq self-assigned this Feb 18, 2015
@dbaq
Copy link
Member

dbaq commented Feb 18, 2015

Hey @christyrajupaul, thank you for opening this issue. I will look into it.

@adbl
Copy link

adbl commented Mar 10, 2015

+1 !

@olasfar
Copy link

olasfar commented Apr 29, 2015

+1

2 similar comments
@azywong
Copy link

azywong commented May 8, 2015

+1

@kentmw
Copy link
Contributor

kentmw commented May 28, 2015

+1

@dbaq
Copy link
Member

dbaq commented May 28, 2015

Quick question: what type of documents you guys want to attach? images? videos? audios?

@kentmw
Copy link
Contributor

kentmw commented May 28, 2015

I just want to be able to send multiple recipients. I believe that MMS is required for that, correct?

@dbaq
Copy link
Member

dbaq commented May 28, 2015

yes for android (if you want to start a group message)

@olasfar
Copy link

olasfar commented May 28, 2015

I want to attach an image. Thx @dbaq

@dbaq
Copy link
Member

dbaq commented May 29, 2015

Alright guys, I would like some feedbacks on the new JS API for this plugin. Here is what I want to do:

Two functions to improve readability and avoid confusion:

  • sms.sendSMS = function(recipient, message, options, success, failure)
    The function send(..) will be renamed into sendSMS(..) and will be the same as today. It will accept only one recipient (or null), with the possibility to send the text message directly without opening the intent on android. Exactly the same as today, except that if the function is called with an array of recipients an error will be thrown, sendMMS must be use instead.
  • sms.sendMMS = function(recipients, message, attachments, options, success, failure)
    For multiple recipients and attachments, you will have to use sendMMS(..). If there are multiple recipients, it will be a group message (the MMS won't be sent to each recipient). Recipients could also be null.

Another question: would you guys be interested if I expose some functions to test the availability of the features (i.e. canSendSMS() and canSendMMS()) ?

Feedbacks highly appreciated. Thanks.

@kentmw
Copy link
Contributor

kentmw commented May 29, 2015

I think what you outlined works well. I worry about backwards compatibility if you change the api to sendSMS. Can you keep send and forward it to sendSMS?

@dbaq
Copy link
Member

dbaq commented May 29, 2015

Yep already thought about that. Look at this commit:
87a6f3b

@brodycj
Copy link
Contributor

brodycj commented May 29, 2015

Two functions to improve readability and avoid confusion:

I am sorry to say that I do not really like this idea. The telecom industry has made efforts towards unified messaging, see: http://en.wikipedia.org/wiki/Unified_messaging; iOS was a nice example 8 years ago.

Better to add to the options object, and/or add new (optional) parameters, that can specify whether you want to use SMS or MMS.

@olasfar
Copy link

olasfar commented May 29, 2015

@dbaq I agree with @brodybits

Can't we keep the old function "sms.send()" and count on options.attachments to do the switch ?

@dbaq
Copy link
Member

dbaq commented May 29, 2015

Alright alright, that seems a good argument as well + no need to update your current implementations. I will do a first iteration on a branch for iOS over the weekend.

So does everybody agree on:

sms.send(recipients, message, options, success, failure);

  • recipients: could be null, a string or an array
  • message: string or null
  • options: we add attachments in it (we'll see the format later)

If there are some attachments or if recipients is an array, a MMS will be sent. Otherwise, it will be a regular SMS.

@olasfar
Copy link

olasfar commented May 29, 2015

Sounds perfect :)

@brodycj
Copy link
Contributor

brodycj commented May 29, 2015

Thanks 👍

@kentmw
Copy link
Contributor

kentmw commented May 29, 2015

Beautiful

@brodycj
Copy link
Contributor

brodycj commented May 29, 2015

If there are some attachments or if recipients is an array, a MMS will be sent. Otherwise, it will be a regular SMS.

I would actually suggest some form of an override option, in case someone wants to send MMS to a single recipient with no attachments, for example. (Existence of an attachment would definitely eliminate the SMS option.)

@agarrharr
Copy link
Member

Another reason you might also want an override option is because you might want to send single sms messages to multiple recipients.

@dbaq
Copy link
Member

dbaq commented May 29, 2015

@brodybits what would be the use case? Why would you want to send a MMS without attachment to a single number?

@Aharris88, I really don't like this idea of sending a single SMS to multiple recipients. It complexifies the code of the plugin (especially for android without starting the composer), what do you return if there is an error for the nth recipient? should you stop at the first error? should you move on to the next one? which callback do you call? Instead the developer can simply iterate over an array and call the method with a single phonenumber.

@brodycj
Copy link
Contributor

brodycj commented May 29, 2015

On May 29, 2015 7:29 PM, "Didier Baquier" [email protected] wrote:

@brodybits what would be the use case? Why would you want to send a MMS
without attachment to a single number?

@Aharris88, I really don't like this idea of sending a single SMS to
multiple recipients. It complexifies the code of the plugin (especially for
android without starting the composer), what do you return if there is an
error for the nth recipient? should you stop at the first error? should you
move on to the next one? which callback do you call? Instead the developer
can simply iterate over an array and call the method with a single
phonenumber.

IMHO we should be very careful. We never know what people will need for a
use case.

My vote would be to have the simplest API, always with a manual override if
not manual selection just in case, and let higher-level libraries provide
additional features that people may think of.

My $0.02 worth.

@dbaq
Copy link
Member

dbaq commented May 29, 2015

Definitely, I want to provide the simplest and the less confusing API possible. This parameter can always be added later if needed by somebody.

I am going to stick with #14 (comment) for the first iteration.

@agarrharr
Copy link
Member

I think that's a good call and the easiest to implement. I don't think the 2 edge cases we mentioned are worth supporting.

@dbaq
Copy link
Member

dbaq commented May 29, 2015

You guys can follow the development on the https://github.com/cordova-sms/cordova-sms-plugin/commits/WIP_MMS_support branch. I will come back to you when I got something stable on iOS.

@SniperFox1
Copy link

Can somebody pleeease make this happen for Android? I wish I could help but I don't know any java. I believe you need MMS support if you want to send to an e-mail, right? Also, attachments feature would be nice to have...

@cmosboss
Copy link

@dbaq while I know true MMS support is long off, above you mentioned adding image for android. Is it possible to send an image via android with no intent ? I would love to add that feature to my app, let me know thanks.

@dbaq dbaq mentioned this issue Sep 13, 2017
@arizona2014
Copy link

hi guys ... tryed today to send to multiple recipients so I used an array like ['number1','number2] and managed to receive the message only at number1 recipient. If I changed ['number2','number1] i recieved the message only at number2. So clearly it sends only to first element of array.

Do you have in mind a solution for the multiple recipients ?

@z4h1
Copy link

z4h1 commented Dec 13, 2017

soooo... no mms support?

@amirul1000
Copy link

I need to verify the phone no.after success I need to track the sender phone no
How may I get this no

@agarrharr
Copy link
Member

@amirul1000 Please open a new issue. 😄 This issue is about mms support.

@rolinger
Copy link

rolinger commented Jan 25, 2018

Whats the status of the current effort?

  1. Add MMS multiple recipients to Android native and iOS native?
  2. Add MMS multiple recipients to cordova Android custom app composer?
  3. Add MMS file/image attachments to Android native and iOS native?
  4. Add MMS file/image attachments to cordova Android custom app composer?

I am not a java guy, but for attachments to native Android and iOS composers, could elements from the cordova-plugin-email code be reused for attaching images for native MMS apps? I am using that plugin and attaching images to native email composers works just fine...I was skimming through that plugin to see the attachment code - but I have no idea if that could be reused here for MMS purposes.

cordova-plugin-email

email attachment code

I reached out to the owner of cordova-plugin-email to see if he might be able to help or contribute.

@agarrharr
Copy link
Member

@rolinger I believe that there is currently no one working on this, but contributions are welcome. 😸

@dbaq
Copy link
Member

dbaq commented Jan 29, 2018

Yep, there is a branch with some dev on it.

iOS is pretty much straightforward (multiple recipients + attachments) because we are simply using their APIs.

On the other hand, Android is a pain to manage. A lot of different composers + intent vs no intent use case.

PRs are welcome if you would like to help.

@jondspa
Copy link

jondspa commented Mar 2, 2018

Hi -

I'm not a github/plugin expert but I managed to merge this plugin with plugin https://github.com/christyrajupaul/Phonegap-MMS-Plugin. With this merge, I can send MMS from Android, no problem. These files do not work with iOS.

I start with this great plugin, change two files, and I'm done. I recently verified it works in Android 7 and 8 but of course, with Android permission changes, I have to include https://github.com/NeoLSN/cordova-plugin-android-permissions and have the user allow
WRITE_EXTERNAL_STORAGE permission.

The first file attached is ../platforms/android/platform_www/plugins/cordova-sms-plugin/www/sms.js and the second file is ../platforms/android/src/com/cordova/plugins/sms/Sms.java.

I hope I'm not forgetting anything! Good luck. - Jon

sms.js.txt
Sms.java.txt

@rolinger
Copy link

rolinger commented Mar 2, 2018

@jondspa - for permissions, I use cordova-plugin-diagnostic - it has everything you need for both iOS and Android

Can you please post the link to the new merged plugin? Maybe some one who knows Xcode can analyze what you have done for Android and create the iOS version. This is closer than anyone else has gotten thus far.

@jondspa
Copy link

jondspa commented Mar 2, 2018

Thanks, I'll look into cordova-plugin-diagnostic.

For iOS, I just use this version of the plugin, which works great! https://github.com/cordova-sms/cordova-sms-plugin.git#WIP_MMS_support

For Android, I left off the new calling scheme. Here's a snippet from my code:

    intent = 'INTENT';
    if (dataURL === "" || dataURL === null) {
        sms.send("", string, "", intent, success, error);
    } else {
        sms.send("", string, dataURL, intent, success, error);
    }
    success = function () {
        if (DEBUG) {
            window.alert('Message sent successfully');
        }
    };
    error = function (e) {
        if (DEBUG) {
            window.alert('Message Failed:' + e);
        }
    };
  • Jon

@dbaq
Copy link
Member

dbaq commented Mar 2, 2018

Thanks to the both of you. Before someone opens a PR, we should agree on the API. It should be consistent between iOS and android. I made some propositions in the past (see #14 (comment)).

@AramVave
Copy link

AramVave commented Mar 8, 2018

I have installed the plugin recently, but it still only accept 3 arguments.

@rolinger
Copy link

rolinger commented Mar 9, 2018

@AramVave - this plugin still is sms only.

@jondspa - your above link simply points back to this same cordova-sms-plugin - which has no MMS capability. You said you merged Phonegap-MMS-Plugin with this (cordova-sms-plugin) plugin to create a new plugin that allows MMS support for Android - is this correct? If so, please post the link the to newly merged plugin so 1) others can use it for Android MMS and 2) others can evaluate it to see if there is a way to make it work for iOS.

If we can get it working for iOS too then we can fork a whole new cordova-MMS-plugin off of it.

Thanks.

@dbaq
Copy link
Member

dbaq commented Mar 9, 2018

@rolinger I believe the MMS feature should not be a fork, it should be included in this repo. It is a fairly popular request.

@rolinger
Copy link

rolinger commented Mar 9, 2018

@dbaq - roger that.

@AugusDogus
Copy link

@dbaq Are you working on the changes necessary for MMS to be included in this repo? Three years later is slightly demotivating.

I think some changes would be better than no changes and that if anyone has problems with the design of the API they can submit a PR in the future or open an issue.

@dbaq
Copy link
Member

dbaq commented Apr 1, 2018

hello @AugusDogus,

As I mentioned before, I have no time to work on new features (I only fix blocking issues). If you want to contribute, feel free to open a PR. To be consistent, the PR should contain a working solution for both iOS and android. Thank you.

@surajwasnik
Copy link

@jondspa please provide the link of merge plugin, I use the plugin for IOS from the link you mention above but there is not option to attached image so how MMS work ?

I request you @dbaq also please at least suggest me for IOS.

Million of thanks in advance.

@Eugenizer
Copy link

hello @dbaq
This branch - https://github.com/Agent00krosh/cordova-sms-plugin resolve this issue. Can you check it and merge if everything is good?

@dbaq
Copy link
Member

dbaq commented Mar 15, 2019

hey @Eugenizer,

thanks for pointing this branch out. It looks like the android code is not ready yet:
Some values are hardcoded:

        String saveFilePath = Environment.getExternalStorageDirectory() + "/HealthAngel";
        File dir = new File(saveFilePath);


        if (!dir.exists()) {
            dir.mkdirs();
        }

        File file = new File(dir, "logo.png");

@IgorYanchuk
Copy link

hello @dbaq
thanks for the comment for Eugenizer, I fixed the code

@TravisHeaver
Copy link

@dbaq are you able to merge in @Agent00krosh fixes? I am having the same issue. I may also have an additional improvement. The dispatch_async(dispatch_get_main_queue() takes a few seconds the first time it is called, by moving MFMessageComposeViewController into the main_queue the delay is gone

@dbaq
Copy link
Member

dbaq commented Nov 2, 2020

Please open a PR when the code is ready to be reviewed. We can then decide whether or not we want to include this feature in this repo.

@noriellecruz
Copy link

how about this pr? #224

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