iOS SMS Dialog module

You must Login before you can answer or comment on any questions.

Hi fellow devs,

I only wanted to let you know that I just published on github an iOS module for sending in-app text messages.

Check it out here: https://github.com/omorandi/TiSMSDialog

Cheers!

— asked 4 years ago by Olivier Morandi
3 Comments
  • Thank you! Works perfectly for me, just what I needed.

    — commented 3 years ago by Philip Kaplan

  • Hello Oliver! Thank you for a fantastic module! It works great except for one thing. I am developing an app with contact data (phone numbers) and if I click an number the dialog opens up but if I then closes it and clicks on the number again the app crashes. But if I change window and try another number it works fine! What can be wrong?

    — commented 3 years ago by James -

  • Hi Daniel, glad you find the module useful. I had another guy reporting problems when opening the sms dialog as a result of a selection in the contacts dialog, but its code didn't crash the app. I'd be happy to help you. Could you just send me an email at olivier.morandi @ google mail service with some more details and a code snippet capable of reproducing the problem?

    — commented 3 years ago by Olivier Morandi

21 Answers

Getting build failed error when trying to "./build.py" Here is the log http://pastie.org/1445993

Can u plz help me out?

Thanks.

— answered 4 years ago by Altaf Sayani
answer permalink
5 Comments
  • I answered to this in a private message exchange and I forgot to drop a line here for all to be informed. In the meantime I've added the following note on the github repository:

    Note: The module has been built using version 1.4.3 of the Titanium Mobile SDK, and the build system expects that SDK to be installed in your system. If you get build errors, the cause might be that the above requirement is not met. In order to overcome the problem you should modify the TITANIUM_SDK_VERSION value at line 7 of the titanium.xcconfig file, in order to match the version number of the SDK actually installed on your machine (e.g. 1.5.1).

    — commented 4 years ago by Olivier Morandi

  • oliver your comment helped me after many many MANY hours of wondering why the heck a module would build successfully on my laptop but not on my mac pro. then i checked and for some reason the latest Ti Mobile SDK was installed in

    ~/library/application support/titanium/
    instead of being installed in
    hard drive/library/application support/titanium/
    once i copied that over, it all worked just fine :)

    thanks again for the updated comment oliver!!

    — commented 3 years ago by danno watts

  • Glad it helped! cheers

    — commented 3 years ago by Olivier Morandi

  • Show 2 more comments

Hi,

I got error:- here is my stack trace: http://pastie.org/1573419

-----------------It tells invalid method (createSMSDialog).

Whats the reason ? Please help to solve this.

— answered 4 years ago by bhavya mehta
answer permalink
1 Comment
  • Hi bhavya, could you please give me some more info on the context? Please just drop me an email (you find it in the README.md file of the module's code) with anything would be useful to reproduce the error (included js source, your xcode/ios sdk version and titanium mobile sdk version) and I'll be happy to take a look at the issue.

    — commented 4 years ago by Olivier Morandi

This is a great module for sending Text Messages via Titanium!! Appcelerator just add this into their own APIs, it's very good. Thank you for sharing!!

Great job. But how can I set the (default) device language instead of english?

— answered 3 years ago by Danny Pham
answer permalink
1 Comment
  • Hi Danny, you can modify the info.plist file you'll find in the build/iphone directory, by changing the "Localization native development region" key to an appropriate value, as suggested here

    — commented 3 years ago by Olivier Morandi

Olivier,

Looks like I received an error while executing the build script, any assistance? Anything obvious?

http://pastie.org/1901340

Cheers!

— answered 3 years ago by Tracy Hayman
answer permalink
6 Comments
  • Hi,

    It's likely that you don't have Ti SDK version 1.4.3 which he defined in the titanium.xconfig file.

    Edit that file to reflect a version of the SDK which you do have.

    I had the same errors above, then changed the version in the config file and the build ran fine.

    hope this helps

    — commented 3 years ago by Kosso .

  • Yep, I just downloaded the Ti SDK 1.4.3 and now it builds perfect! Sweeeeeeet! Thanks Olivier! And Kosso!

    — commented 3 years ago by Tracy Hayman

  • And here is a convenience link to the continuous builds:

    — commented 3 years ago by Tracy Hayman

  • Show 3 more comments

Looks and works great! tnx for this.

Now hoping someone has an email dialog like this, having 2 styles of sending email and sms is akward. Is there such an module for email?

— answered 3 years ago by Kami -
answer permalink
2 Comments
  • There is no difference between the Email and SMS Dialogs? The SMS Dialog was built to be exactly the same as the Email one. What are you referring to being "2 styles of sending email and sms"?

    You type it in, then send them to the subject. How is that awkward/different style?

    — commented 3 years ago by Colton Arabsky

  • you are using this sms dialog as an email dialog then???

    kinda like to see sum code on how i could achieve that.

    what i meant was that this sms dialog for sms has its style, but there is nothing like this for email. And the basic email dialog is ugly and then you have 2 styles, the pretty sms one and the ugly email one

    — commented 3 years ago by Kami -

looking for in-app SMS/MMS module for Android......

anyone know of one?

~Brian

— answered 3 years ago by Brian Dittmer
answer permalink
2 Comments
  • If you don't need to be notified about the result of the operation you could use Android Intents:

    var intent = Ti.Android.createIntent({
            action: Ti.Android.ACTION_VIEW,
            type: 'vnd.android-dir/mms-sms'
        });
        intent.putExtra('sms_body', 'new message from me');
        intent.putExtra('address', '123456789');
        Ti.Android.currentActivity.startActivity(intent);
    Check out this post for a more detailed discussion.

    — commented 3 years ago by Olivier Morandi

  • Hi Brian, if you still need an sms module for android you may be interested in this one I've just shared w/ the community: https://github.com/omorandi/TiAndroidSMS

    — commented 3 years ago by Olivier Morandi

Excellent work! Thank you!

— answered 3 years ago by Bogdan Irimia
answer permalink
3 Comments
  • Thanks!

    — commented 3 years ago by Olivier Morandi

  • Double that, excellent job. Appcelerator should pay out some bounties for these really useful pieces of development and include them in their next versions.

    Especially when you've done both iOS and Android.

    Chris

    — commented 3 years ago by Chris Moore

  • Hey, thanks a lot!

    — commented 3 years ago by Olivier Morandi

Please find a screenshot for the error http://imageshack.us/photo/my-images/163/screenshot20110823at715.png/

— answered 3 years ago by Ahmed Tarek
answer permalink
5 Comments
  • Hi, it looks like the module is not correctly installed...

    — commented 3 years ago by Olivier Morandi

  • i do the following steps correctly

    unzip -u -o com.omorandi-iphone-0.2.zip -d /Library/Application\ Support/Titanium/

    • i find that the zip file disappear & the folder created by the following name "omorandi-TiSMSDialog-b114696"

    then i add to tiapp.xml as following


    <?xml version="1.0" encoding="UTF-8"?> <ti:app xmlns:ti="http://ti.appcelerator.org"> <deployment-targets> <target device="mobileweb">false</target> <target device="iphone">true</target> <target device="ipad">true</target> <target device="android">true</target> <target device="blackberry">false</target> </deployment-targets> <id>T</id> <name>T</name> <version>1.0</version> <publisher>giga_tarek</publisher> <url>http://</url> <description>not specified</description> <copyright>2011 by giga_tarek</copyright> <icon>appicon.png</icon> <persistent-wifi>false</persistent-wifi> <prerendered-icon>false</prerendered-icon> <statusbar-style>default</statusbar-style> <statusbar-hidden>false</statusbar-hidden> <fullscreen>false</fullscreen> <navbar-hidden>false</navbar-hidden> <analytics>true</analytics> <guid>3a04d524-8be0-431d-a042-f81eea821986</guid> <iphone> <orientations device="iphone"> <orientation>Ti.UI.PORTRAIT</orientation> </orientations> <orientations device="ipad"> <orientation>Ti.UI.PORTRAIT</orientation> <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation> <orientation>Ti.UI.LANDSCAPE_LEFT</orientation> <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation> </orientations> </iphone> <android xmlns:android="http://schemas.android.com/apk/res/android"/> <modules/> <modules> <module version="0.2" platform="iphone">com.omorandi</module> </modules> </ti:app>


    im confuse with the following 2 steps.

    im sorry but im new here & need somehelp

    — commented 3 years ago by Ahmed Tarek

  • I'll try to contact you by mail

    — commented 3 years ago by Olivier Morandi

  • Show 2 more comments

i create application that sent SMS perfectly thanks to your module. now I'm try to do the following when mobile receive SMS with specified txt , i want to forward it automatically to another fixed no.

eg. i receive sms with text body " Hello" from 123 . i want to FWD it to 678 automatic without any interfere from the user.

can anyone help me with the code ?

— answered 3 years ago by Ahmed Tarek
answer permalink
1 Comment
  • I do not believe Apple would allow you to send an SMS message without user interaction. As such, the native SDK only supports displaying the SMS window and doesn't offer the code to send one programatically.

    — commented 3 years ago by Mike Robinson

How to target "Cancel" EventListener, the confirmation message appears in either way whether the user pressed the "send" button or the "cancel" button! I tried adding a cancel eventListener like this .addEventListener('cancel', function(e) but it didn't work! it still listener only to the .addEventListener('complete', function(e)

— answered 2 years ago by Talal Manaa
answer permalink
1 Comment
  • "complete" is the only event generated. Then you should check the result of the operation, which is reported through the event object to the event listener:

    smsDialog.addEventListener('complete', function(e){
        if (e.result == smsDialog.SENT)
            {
                //do something
            }
            else if (e.result == smsDialog.FAILED)
            {
               //do something else
            }
            else if (e.result == smsDialog.CANCELLED)
            {
               //don't bother
            } 
    });

    — commented 2 years ago by Olivier Morandi

Great Module Oliver and thanks for help, will i be able to detect the values of recipients and messageBody if the user changed them when message sent successfully ? like the following for example:

smsDialog.addEventListener('complete', function(e){ if (e.result == smsDialog.SENT) { //do something alert(smsDialog.recipients + " " + smsDialog.messageBody); } else if (e.result == smsDialog.FAILED) { //do something else alert(smsDialog.recipients + " " + smsDialog.messageBody); } else if (e.result == smsDialog.CANCELLED) { //don't bother alert(smsDialog.recipients + " " + smsDialog.messageBody); } });

thank you in advanced

— answered 2 years ago by Talal Manaa
answer permalink
1 Comment
  • No, you don't have control on what the user does after he is presented with the dialog (it's a limitation imposed by the iOS API). All information you have is the result of the operation.

    — commented 2 years ago by Olivier Morandi

Hi All, I've been trying to build but got errors that TiModule.h and other file were not found. I've modified the titanium.xcconfig file and made these changes:

TITANIUM_SDK_VERSION = 2.0.1.GA2
TITANIUM_SDK = /Users/<YourHomeFolderNameHere>/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)
And the module built successfully, best of luck to you.

— answered 2 years ago by bassem ahmed
answer permalink
1 Comment
  • Were you able to get Titanium to use it once you built it? Mine built successfully but I get a error saying it's not supported with 2.0.1.GA2

    — commented 2 years ago by Chris Ditty

I want to embed small images ( smiley and emoticons from the app) in the SMS (MMS). Is that possible ?

Any help will be highly appreciated

Regards Geervani

— answered 2 years ago by Geervani BS
answer permalink
1 Comment
  • Hi, Programmatically sending MMSs is not supported on iOS. The only way I see for sending emoticons is using the Emoji character set, which will work only for messages sent across iOS devices, and with the limitations exposed here

    — commented 2 years ago by Olivier Morandi

Can anyone tell, how to set the sms sender from Private to any other Text in Omorandi module?

— answered 2 years ago by Abdus Sattar
answer permalink
1 Comment
  • You cannot do this programmatically. With the module you obtain the same effect as sending the message through the Messages app. If you want the caller id to be shown you must enable it in the settings.

    — commented 2 years ago by Olivier Morandi

Thanks I will test it too. One relevant question. Is it possible to programmatically send the sms message without the user having to actually click the send button, in case certain conditions are met?

— answered 4 years ago by Vassilis Papakonstantinou
answer permalink
1 Comment
  • Hi Vassilis, iOS doesn't allow you to programmatically send a message. All you can do is to present the dialog to the user (possibly pre-populated with predefined recipient numbers and message body). It's user's responsibility to actually hit the send button. Bye.

    — commented 4 years ago by Olivier Morandi

Brilliant work, just what we needed!!

Works like a charm, would be nice be able to change the sms title though... now it just shows "New Message", would be cool to be able to change it to another language, or even some custom title :)

Never the less, greate work!! :D

— answered 4 years ago by Svend Thorsson
answer permalink
4 Comments
  • Svend, thank you! You're right, at the moment the navbar title is the default one, which is provided by iOS. I'll try to address the issue in a forthcoming release of the code. Regards.

    — commented 4 years ago by Olivier Morandi

  • I will be looking forward to that.

    — commented 4 years ago by Svend Thorsson

  • I agree, this works great, but it would be really nice if it was possible to change the "New Message" text. But anyway, thanks so much I've been waiting this capability for a few releases.

    — commented 4 years ago by Tony Perez

  • Show 1 more comment

can a photo be sent via this in-app sms/mms module too?

~Brian

— answered 4 years ago by Brian Dittmer
answer permalink
1 Comment
  • Hi Brian, the SMS dialog can only send text messages. It's a limitation imposed by the underlying iOS API, which doesn't provide MMS sending functionalities.

    — commented 4 years ago by Olivier Morandi

Your Answer

Think you can help? Login to answer this question!