Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    48

    sending a message

    i want my app to send a message but the messages are stored within the app itself, a user has to browse through them and then selects one to send to it's intended receiver,
    how do i go about this.

  2. #2
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: sending a message

    Is your problem related to how to store messages or how to send (SMS?) messages ?
    If messages are fixed, final strings can help. Otherwise, you can use the RMS. for displaying, lcdiu lists will do the job.
    And about sms, we have examples in our wiki.

    http://developer.nokia.com/Community...SMS_in_Java_ME

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    48

    Re: sending a message

    yes my app is related to how to store several messages with in the app itself and a user can choose to select between then by pressing the next and previous commands.
    please send me the source code of how this can be done.\
    thanks.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,790

    Re: sending a message

    For handling lists, MIDP offers a class called List, http://docs.oracle.com/javame/config...cdui/List.html
    Some related article from our Wiki: http://developer.nokia.com/Community...ist_in_Java_ME
    For sending messages, there is WMA, the Wireless Messaging API, http://www.oracle.com/technetwork/java/wma-140501.html
    Some related article from our Wiki: http://developer.nokia.com/Community..._Messaging_API, also see the linked category pages.

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    48

    sms help

    i want when i click send, it should bring the message from the current displayable screen let's say if i click send when am on the third screen it should bring exactly what is on the third screen and this be the same for the rest.(it should fetch messages from current displayed screens)
    i tried this code and failed.


    Code:
    	protected void startApp() throws MIDletStateChangeException
    	{
    	Form form = new Form("SMS Test");
    phone = new TextField("Phone number", "", 255, TextField.PHONENUMBER);
            form.append(phone);
              message = new TextField("Message", "", 160, TextField.ANY);
            form.append(message);
           form.addCommand(send = new Command("Send", Command.OK, 1));
            form.addCommand(exit = new Command("Exit", Command.EXIT, 1));
            form.setCommandListener(this);
    Display.getDisplay(this).setCurrent(form);
    	}
    	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)
    		{
    			result = false;
    		}
    		catch (Exception e)
    		{
    			result = false;
    		}
    		return result;
    	}
    	public void commandAction(Command c, Displayable d)
    	{
    		if(c == exit)
    		{
    			notifyDestroyed();
    		}
    		else
    		{
    			new Thread(this).start();
    		}
    	}
    	public void run()
    	{
    		boolean result = sendSms(phone.getString(), message.getString());
    		
    		
    	}
    }
    Last edited by wizard_hu_; 2014-03-04 at 12:03. Reason: [CODE][/CODE]

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: sms help

    Please refer to this wiki link - http://developer.nokia.com/community...SMS_in_Java_ME

    Download the source code of the complete app try it ... it will solve your issue.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,790

    Re: sms help

    Note that the article has been mentioned already. Based on the code fragments in the post, juliusa is likely using it already.

Similar Threads

  1. Confirmation Message while sending the Message
    By Abhishek_karmakar in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2009-01-07, 07:23
  2. Nokia 2630 "message alert tone" when sending a message!
    By eludlow in forum General Development Questions
    Replies: 2
    Last Post: 2008-02-18, 21:42
  3. Message Sending Failed message in Nokia 6600 when Memory In Use set to MMC
    By razas in forum General Development Questions
    Replies: 0
    Last Post: 2006-02-01, 08:06
  4. Sending/receiving sms and sending wap push message
    By noelfern501 in forum General Messaging
    Replies: 3
    Last Post: 2004-05-31, 09:20
  5. Sending WAP Push Message / Service Settings Message
    By ivoice in forum Smart Messaging
    Replies: 1
    Last Post: 2003-07-22, 07:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×