answersLogoWhite

0


Best Answer

this is the code to send sms using J2ME programing language.

------------------------------------------------------------------------------------------------------------

/*

* @(#)SMSSend.java 1.8 04/03/22

*

* Copyright (c) 1999-2004 Sun Microsystems, Inc. All rights reserved.

* PROPRIETARY/CONFIDENTIAL

* Use is subject to license terms

*/

package example.sms;

import javax.microedition.midlet.*;

import javax.microedition.io.*;

import javax.microedition.lcdui.*;

import javax.wireless.messaging.*;

import java.io.IOException;

/**

* An example MIDlet to send text via an SMS MessageConnection

*/

public class SMSSend extends MIDlet

implements CommandListener {

/** user interface command for indicating Exit request. */

Command exitCommand = new Command("Exit", Command.EXIT, 2);

/** user interface command for proceeding to the next screen */

Command okCommand = new Command("OK", Command.OK, 1);

/** current display. */

Display display;

/** The port on which we send SMS messages */

String smsPort;

/** Area where the user enters the phone number to send the message to */

TextBox destinationAddressBox;

/** Error message displayed when an invalid phone number is entered */

Alert errorMessageAlert;

/** Alert that is displayed when a message is being sent */

Alert sendingMessageAlert;

/** Prompts for and sends the text message */

SMSSender sender;

/** The last visible screen when we paused */

Displayable resumeScreen = null;

/**

* Initialize the MIDlet with the current display object and

* graphical components.

*/

public SMSSend() {

smsPort = getAppProperty("SMS-Port");

display = Display.getDisplay(this);

destinationAddressBox = new TextBox("Destination Address?",

null, 256, TextField.PHONENUMBER);

destinationAddressBox.addCommand(exitCommand);

destinationAddressBox.addCommand(okCommand);

destinationAddressBox.setCommandListener(this);

errorMessageAlert = new Alert("SMS", null, null, AlertType.ERROR);

errorMessageAlert.setTimeout(5000);

sendingMessageAlert = new Alert("SMS", null, null, AlertType.INFO);

sendingMessageAlert.setTimeout(5000);

sendingMessageAlert.setCommandListener(this);

sender = new SMSSender(smsPort, display, destinationAddressBox,

sendingMessageAlert);

resumeScreen = destinationAddressBox;

}

/**

* startApp should return immediately to keep the dispatcher

* from hanging.

*/

public void startApp() {

display.setCurrent(resumeScreen);

}

/**

* Remember what screen is showing

*/

public void pauseApp() {

resumeScreen = display.getCurrent();

}

/**

* Destroy must cleanup everything.

* @param unconditional true if a forced shutdown was requested

*/

public void destroyApp(boolean unconditional) {

}

/**

* Respond to commands, including exit

* @param c user interface command requested

* @param s screen object initiating the request

*/

public void commandAction(Command c, Displayable s) {

try {

if (c '+') {

startPos = 1;

}

for (int i = startPos; i < chars.length; ++i) {

if (!Character.isDigit(chars[i])) {

return false;

}

}

return true;

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you program a mobile phone's J2ME for seding SMS messages?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How many five ways in which email message could be made more effective?

SEDING TEXT MESSAGES


What is the plot of the Pretty Little Liars series?

Its about 5 girls hanging out for the summer but when 1 girl dies they all lose contact aria moves away hanna becomes popular Spencer is well Spencer and Emily hide some more secrets through this journey to become friends again they find that some one called "A" is seding them thing that only they knew or ali ,the girl who got killed,knew Strage right Allison starts with "A".....


I am gay and I love my straight friend how should I tell him?

Just say to him that you like him and that you want to be with him, if he is straight then there is no point of doin it at all. Hope you understand my broken English coz I'm not from an English speaking country. I just don't know how long you've been waiting to tell him how you feel about it. I just know that it's really hard to hold this feeling for so long. At this time I am right in love with a guy... I'm so confused up too. I just don't know exactly if I'm the most indicated person to answer your question. I think no one can actually decide but you. I have had such a good answer and bad one. Since from the first time I decided that I should say about my feelings... I proceed this way... it's not easy because it takes so much time and I just don't know exactly when is the right time to say. The first time I directly told a friend that I loved him I wrote him a letter. We have been toghether for 6 months but I decided not to carry on coz he used to get out with some other girls... It's hard to explain. Since from that time, I've been in love with guys two other times (including now) - Last time I've made several things to try to show him how I was feeling... After one year he dropped me a message in my mobile telling that I rather better quit seding him messages... I was not direct in my messages... I used to write in order to instigate him to have a talk... I heard from him that it was not his cup of tea. This time I burnt a cd with a letter and some videos (luke and noah) and gave him. He just don't tell me anything. I'm going insane about it. I just don't know if he already saw the cd. If he saw and is preteding he didn't see... whatever... Guy - the most important is the truth. Just be careful to find the better way to say or write him about your feelings. You just don't know what else is going to happen if you tell. But you possibly know that nothing else is going to happen if you don't tell. You must let him know that all that you want and need is to feel free from this feeling that is pushing you insane. Good luck.


What are software protocols?

PROTOCOL : Is a set of "RULES" and "REGULATIONS" for seding and receiving Information on the NETWORK, by using the standard protocols.TCP/IP.imran quadri.Answer--A protocol is a set of rules or agreed upon guidelines for communication. When communicating, it is important to agree on how to do so. If one party speaks Indian and one German the communications will most likely fail. If they both agree on a single language, communications will work. On the Internet the set of communications protocols used is called TCP/IP. TCP/IP is actually a collection of various protocols that each have their own special function or purpose. These protocols have been established by international standards bodies and are used in almost all platforms and around the globe to ensure that all devices on the Internet can communicate successfully. AnswerAccording to Princeton dictionary, protocol can mean 3 things: - code of behavior, code of conduct- forms of etiquette- communications protocol (computer science)


Where can obsolete foreign money be exchanged?

There are services on-line their prices vary and some unsafe they require investigation on seding for return purchase. Physical options banks that deal with foriegn currency, coin collection shops, travel agencies and even eBay. Some credit card services offer exchanges such as member programs one example is American Express for currently traded currency. International hub Airports too accept "currently" traded currency. There are individuals that collect currency especially European currency made obsolete via the new currency The Euro. You will not retain much value till it reaches a 100 years value. Most are looking for pristine bills towards encasing and vaulting for a future investment. Just as confederate buffs collect confederate monies produced for a limited time. If the currency you have is no longer actively used such as european, USSR or ect in the recent 20 years it is still common and the market flooded it's a matter of coin shops and old currency dealers again looking for pristine bills or unique rare features to encase and vault for future investment. Unfortunately most already house supplies direct via these countries last prints even uncut sheets at a highvalue. Your best option is research the bills in question and may find best source whom to deal. Often common bills no longer exchanged that are recent flood in the market is best sold on ebay or etsy: where buyers either collect for various reasons and even re-sellers as supplies: country, nations, investment or recycle into paper scrapbooking. There are even crafters that collect currency for creating novelty items such as lampshades, decopage cash boxes or poster art. If not worth the shipping cost towards exchange of the value you invested return then again looktowards paper collections buyers for re-manufactured or recycled products production - even some artists exchange too will swap a finished art piece for new art materials. You can even try a recycling this holiday season in paper craft or etc gift giving real but unusable currency after all shredded $100 bills in clear glass christmas ornaments or shreded mache ball ornaments have been marketed for the past 20 years. As an ornament gift save money and same time give a gift that truly expressed you went the distance to give.