sending SMS in j2me


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: sending SMS in j2me

  1. #1
    Join Date
    Jun 2011
    Posts
    1

    sending SMS in j2me

    Code:
    public boolean sendSms(String number, String message){
            boolean result = true;
            try {
              //sets address to send message
              String addr = "sms://"+number;
              // opens connection
              MessageConnection conn = (MessageConnection) Connector.open(addr);
              // prepares text message
              TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
              //set text
              msg.setPayloadText(message);
              // send message
              conn.send(msg);
              conn.close();
            } catch (SecurityException se) {
                // probably the user has not allowed to send sms
                // you may want to handle this differently
                result = false;
            } catch (Exception e) {
                result = false;
            }
            return result;
        }
    Hi guys,
    this is what I use in my application to send SMS. It does work but it odes not always return TRUE. Where do you think might me the error?
    Thank you.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Can you pinpoint any consistencies when False is returned?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Sending a retrieved SMS using Python
    By trips.dude in forum Mobile
    Replies: 0
    Last Post: 11-06-2009, 02:28 PM
  2. (J2ME) Sending SMS with port number
    By kalyan_2001148 in forum Java
    Replies: 3
    Last Post: 05-08-2009, 08:46 AM
  3. sending sms
    By rangaraj in forum VB Classic
    Replies: 1
    Last Post: 08-17-2007, 09:05 AM
  4. sms sending
    By gyoy in forum Mobile
    Replies: 0
    Last Post: 12-23-2002, 04:32 AM
  5. Sending SMS from Siemens M20 Terminal
    By Tomcat in forum Mobile
    Replies: 0
    Last Post: 04-08-2002, 09:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center