Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java SMS send & receive

  • 16-07-2007 11:45am
    #1
    Registered Users, Registered Users 2 Posts: 1,389 ✭✭✭


    I've spent all morning researching and testing various methods of sending and recieving SMS messages for my java application - PC suite API, various gateways, wireless messaging API, bluetooth API, 6230i API... I'm blue in the face from looking!
    The most important part is it can recieve a text message, and respond appropriately to the sms the moment it is recieved with no user interaction. The sms is a complicated GPS string which my java application is decoding and plotting.

    Has anybody got any ideas of what the easiest way of integrating the ability to recieve an sms message from a mobile phone number and pass it as a string into my program? My programming knowledge is limited to first year computer science, and the only language I know is java.

    Thanks!


Comments

  • Closed Accounts Posts: 35 god9


    cianclarke wrote:
    I've spent all morning researching and testing various methods of sending and recieving SMS messages for my java application - PC suite API, various gateways, wireless messaging API, bluetooth API, 6230i API... I'm blue in the face from looking!
    The most important part is it can recieve a text message, and respond appropriately to the sms the moment it is recieved with no user interaction. The sms is a complicated GPS string which my java application is decoding and plotting.

    Has anybody got any ideas of what the easiest way of integrating the ability to recieve an sms message from a mobile phone number and pass it as a string into my program? My programming knowledge is limited to first year computer science, and the only language I know is java.

    Thanks!

    You can use Clickatel - if your app will be an online one (see their website).

    Alternatively what I did it for my final year project was I simply connected a Nokia phone to my pc and you can use the Nokia Software Development Kit (free download) to program - they give tons of sample code so make it pretty easy. you will need a nokia phone that can connect to a pc tho.


  • Registered Users, Registered Users 2 Posts: 590 ✭✭✭dal


    Is it supposed to be a standalone application that runs on the phone (written in j2me)? I am not too sure that there is a way to intercept sms messages when they arrive on your phone.
    For sending, I use smsdiscount - they have a fairly good api (basically just a url) and its only 1c per message.


  • Registered Users, Registered Users 2 Posts: 1,389 ✭✭✭cianclarke


    dal wrote:
    Is it supposed to be a standalone application that runs on the phone (written in j2me)? I am not too sure that there is a way to intercept sms messages when they arrive on your phone.
    For sending, I use smsdiscount - they have a fairly good api (basically just a url) and its only 1c per message.
    It won't be on the phone sorry - it's a java app on an internet connected computer.


    Thanks for the replies from both so far! I've looked at Clickatel - charging far too much though, starting at €15 / month, and the program is probably only going to be used every few months.

    I looked into the Nokia API stuff. I firstly wasn't too fond of relying on PC suite / purely nokia (although I love the things), and also couldn't follow the sheer quantity of API's the provided and which I needed!!!


    The most important part is receiving the SMS messages - sending is quite unimportant. I'm, unfortunately, completely stumped as to how to even start going about achieving this - I'm all out of ideas.
    The program is a executable JAR at the moment with command style (push a b c) interface, it's a basic program by a basic programmer!
    Thanks again


  • Registered Users, Registered Users 2 Posts: 1,127 ✭✭✭smcelhinney


    Ok? Well what you're talking about sounds like an SMSC. Or at the very least some sort of SMS marketing tool.

    So whats the use case?
    * Somebody sends a message to 086XXXXXXX
    * That number is actually linked (somehow) to an application which "listens" for SMS's, processes the SMS and does some sort of logic. (Similar to the way shortcodes like 50104 work, they parse the SMS and if it begins with COMPA, forward it to x, if it begins with COMPB forward it to Y)

    You probably need to look at how tools like O2's Mobile Marketer works, Im sure they'll tell you :)


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    The solution to your problem is really two solutions; one for sending and one for receiving.

    Sending is simple and straightforward enough - just a HTTP connection to a Web based relay that will then pass on the SMS.

    Receiving is more complex as somewhere along the line, someone is going to have to have a number for you, listening for incoming messages (which it will then pass onto you). In short, you're going to have to pay for the privilege - one way or another. Either you use a service provider, who will then 'push' the message to you or you'll need to set it up yourself (using, for example, a GSM modem housing a SIM, connected to the internet connected PC).

    As such €15 p.m. is probably as cheap as you're going to get (as a GSM modem will cost ten times that).


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    Get hold of a GSM SMS Modem. I used one for something similar as a proof of concept project.

    Created a COM+ object that connected to the modem to send the message and read the messages off the modem at intervals. All via a web app written in ASP. Now this was back in 2001 so I am sure that there are plenty of handy apps out there that will do this in a fully API that you can use


  • Registered Users, Registered Users 2 Posts: 590 ✭✭✭dal


    Is having an actual mobile phone connected to the computer not an option? It would seem to me that this would be the cheapest way to acheive your goal.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    dal wrote:
    Is having an actual mobile phone connected to the computer not an option? It would seem to me that this would be the cheapest way to acheive your goal.
    It's an option if he just wants to demonstrate the functionality, it's not if he wants a stable production system.


  • Registered Users, Registered Users 2 Posts: 1,389 ✭✭✭cianclarke


    Adding a mobile phone would be fine if it were to be reasonably futureproof with all upcoming, say, Nokias. I think, however, what I'll do is try and get a GSM modem cheap on eBay and experiment a bit!
    Thanks for the help


  • Registered Users, Registered Users 2 Posts: 1,393 ✭✭✭Inspector Gadget


    The GSM 07.05 spec is still current, I think? If so, follow linky below for the spec document on how this sort of thing is supposed to be done:

    http://www.ctiforum.com/standard/standard/etsi/0705.pdf

    Basically, install the phone as a modem on the computer (with whatever driver it uses), use the virtual COM port that's assigned to it to communicate directly with the phone. Then it's just a matter of firing the correct AT command sequences at it to get it to do what you want.

    This should be device-independent (particularly the "Block Mode" - the text mode systems vary a bit from manufacturer to manufacturer (and even model to model) as far as I remember - but I have to warn you, the last time I did this was a decade ago, when Nokia 2110s were "current"!

    Hope this helps,
    Gadget


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    You could run a small office, low volume production system off a serial connected GSM modem (TC35 , M20 I've used in the past), if setting up with a web based sms incoming notification is out of the question.

    Biggest problem is making sure that your program clears off the old messages in reasonable time. And having a process to alert if there's any issues.

    And since you want to use java, the javax.comm library is a bit finicky but can be got to work.
    Modifying the SerialConnection.java supplied by Sun would get you started. The license is fairly liberal.

    AT+CNMI=2,1,0,0
    will tell the phone to send a notification when an event occurs, such as in incoming message.
    (extra ,0 mentioned in some specs can cause issues)

    AT+COPS?
    Can be used to poll whether the phone can make contact with a basestation. If not trigger alarm.

    AT+CMGL="ALL"
    Will retrieve messages that look like
    +CMGL: 10,"REC UNREAD","+642102730028",,"06/06/19,09:46:51+48",145,11
    Message text here.

    All in all, IMO the javax.comm is not the best interface by a long shot for this work but with patience it will work and stay running reliably.

    Alternatively http://www.rxtx.org/ was suggested to me since, but I've never used it.


Advertisement