Definition Of SMS and MMS Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

To develop my project I have used NETBEANS IDE 6.9.1. After developing my application (as this application includes SMS module, MMS module, GPS part) I have installed it on my mobile phone. For development of this project I have used J2ME technology that is on platform of "JAVA(TM) Platform Micro Edition DSK 3.0".

This application includes SMS (Short messaging service) as well as (MMS) multimedia messaging services which enables us to send / receive SMS from different mobiles. This thesis is a description about the development of an application which enables us to send a short messaging service (SMS) and multimedia messaging service (MMS) from a mobile phone.

Apart from this it has a GPS application. Through which we can get Google map on our mobile phones.

Through this application I have worked on SMS, MMS, GPS modules as well as I have learned J2ME technology on platform of "JAVA(TM) Platform Micro Edition DSK 3.0".

Contents 9



GPS 10


SMS 11

MMS 11

J2ME 12

CHAPTER 2: TEchnologies 13

J2ME 13

Explanation 13

Practice 14

Accomplishment 15

History 15

GPS 15


Aim 21

Future Work 22

Conclusion 22

Reasons for the This Project 22

CHAPTER 4: code Implementaion 22

Life Cycle of a MIDlet 22

How to make a new MIDlet application 23

Aim 25

Software's 26

Explanation of SMS (Short Message Service) code 26

SMS Receive 26

SMS Send 29

MMS Receive 33

Aim 33

Software's 33

CHAPTER 5: Testing 46

Software Installation 46

To Install Netbeans 46

Summary 47

To Connect the Phone to the PC you have two options 47

Installing Application on Our Phone 48

Enable Bluetooth on your Phone 48

CHAPTER 6: Results & Images 49

SMS Module Testing 49

MMS Module Testing 54

CHAPTER 7: Conclusion 56

CHAPTER 8: references 56




GPS is recognized as global positioning system .to improves the services and other products of the companies GPS is the upcoming technology. It is also known as satellite based navigation system which is developed by the US (United States) department of defense (DOD) in the early 1970's.

Here in this project Google map through GPS receiver. It is a US based radio navigation system that provides constant position anyplace in the earth.

It provides exact position and moment in time for unlimited number of users in the world during all whether conditions (day and night).


The basic unit of application structure is net beans is modules. A module which consists of group of communicating classes, collectively with a explanation of the interfaces. Which the module describes of the further modules that which requests to regulate the function.

The whole net beans platform in addition to the application builds on peak of it, where as it separated into several modules.

The basic net beans platform are encumbered by the modules which is recognized as net beans run time beans run time environment encumbers the application modules with dynamism and mechanically, where it is accountable for running application too.

We can say net beans IDE 6.9.1 is a very high quality paradigm of a modular rich user application. On the peak of net beans platform java language support or the CODE editor has been created for the functionality and characteristics' of IDE.

Netbeans IDE 6.9.1 which brings huge benefit to the applications that which can be comprehensive by extra modules and it can be modified according user exact requirements. Whereas allowing some of the modules are not used for deactivating and uninstalling.


SMS is known as short message service. This intends send SMS text message from one mobile to another mobile

Right from standing onwards GSM is included and it recognises the first message is delivered in December 1992 from a system to mobile device in UK.

European telecommunications has improved the global system and SMS. For requirements GSM and SMS principles third generation (3gp's) has been improved.


MMS is known as multimedia message service. which it is improved around 2002 it focuses mainly on developing multimedia context which is associated to SMS service. The SMS is extended into the subsequent level to addition together photos or videos.

MMS technology has two important things which they are open to mobile alliance and 3GPP.It is used for sending and receiving an MMS protocol recognized as multimedia protocol.


The java base or java ME is recognized as java platform 2 micro editions. for the large expansion growth of software devices like cell phones, java program is used in J2ME.J2ME is a part of java program and which intends to grant a group of java API'S for the improvement .when the java is ongoing process it lime rated into JDK (java development kit).it has a huge demand for function in programming interfaces which it is noticed actual global situations.

The collection of different processing mechanism and associated with application manager known as web services.

These web services are self-governing from other web services and applications .then after sun Microsystems Inc. is taken java technology to rebuild it, for addressing requirements of the enterprise. While the sun Microsystems taken improvement for java program it brings all the global users, vendors and technologists into a single platform. which it is recognized as java community program(JCP).Commonly all the enterprises has improved in JP's, it shows that java 2 micro edition(J2ME) has developed.

By improving of JCP (java community program) whereas J2ME also thinks that it should also go through improvement of the web services models globally. With huge change of JCP (java community programme) combined automatically into J2ME web service enterprises.J2ME automatically includes mobiles devices and other pc with global applications.

By huge demand and enlargement users sun Microsystems technologists and JCP has once more improved in J2EE (java 2 enterprise editions) and J2ME.for Mobile devices, excluding pc J2ME has been applied. Where as J2EE has hand over to server side problems.

Figure 1.0 internal Architecture of the NETBEANS IDE

CHAPTER 2: TEchnologies



Java 2 Micro Edition, often abbreviated as J2ME is developed for devices which have limited configuration. Mobile phones and entry-level palmtop devices are configured using Java API's and are collectively called as Mobile Information Device Profile (MIDP). E.g. MIDlet. The main building block of Java 2 Platform is MIDlet.

A smaller version of Java Virtual Machine is the K Virtual Machine and is abbreviated as KVM. The MIDlet is developed to operate in the KVM and is controlled by the application manager. The class which acts as an interface between the MIDlet and application manager is javax.microedition.midlet.MIDlet. This application can do the following functions such as create, start, pause and terminate.

The javax.microedition.midlet.MIDlet class needs to be extended using J2ME applications and hence deals with the following functions:

Control of MIDlet by notifying or requesting the application manager to make state changes in MIDlet.

To give access to MIDlet to retrieve properties from the application descriptor which is a registry containing applications used by the applications manager.

The CLDC - Java 2 Micro Edition has limited configuration and the main benefits of this are:

Java capability for mobile phones and other wireless devices.

Available memory for Java will be 160-512K.

The devices using CDC - Java 2 Micro Edition are mainly powered using a 32 bit processor. The main points to consider here are:

Available memory for Java is 2Mb or more.

The network connection is wireless with a low bandwidth equal to less than 9600bps.

Both the above differ only in their memory and presentation abilities. J2ME is user friendly with all devices using java. The main companies like Nokia, Motorola, Panasonic has java enabled devices.

The key points to note from Java Platform Micro Edition (Java ME) are:

A user friendly environment for many applications to run on mobile phones and other embedded systems.

They have built in protocols to be obeyed in network, user friendly interface, offline application download capability.

Compatible and transportable and hence used in many devices.

Designed and developed by Sun micro system which is owned by Oracle. The software was originally developed by java society process (JSR 68) and has undergone changes during each JSR. Sun Microsystems depends on outside third parties to obtain free binary implementations.


The main advantage of J2ME is its ability to be transferred and emulated using personal computer during the initial stages. After development it can be easily installed on phones. The main profile used is the Mobile Information Device profile mainly implemented in mobile phones and other embedded devices. They have GUI and API where as basic 2d gaming is included in MIDP 2.0.

The application used in this profile was known as "MIDlets". Most of the cell phones now have MIDlet capability. In near future, MIDlets will be used in most of the cell phones in North America. MIDP3 also known as Mobile Information Device Profile 3, a new generation profile will improve the functional capabilities and operations between devices.


The implementation of MIPD and CDC were provided to "Sun Micro Systems". Netbeans support "JAVA(TM) Platform Micro Edition DSK 3.0". Now Oracle has taken over Sun Micro Systems.


The class file format version 47.0, 2008 is used in all Java ME platforms and has limited JRE 1.3 capabilities. The latest formats such as JRE 1.5 and 1.6 are yet to be supported by Sun Microsystems. A new project named phone ME was released on December 22, 2006, when license was issued for Java ME source code by GNU general public license.


Experimental block has launched in 1978, whereas major block 2 has launched in February 14, 1989.

Due to usage of military users US President Bill Clinton noticed its significance, and then confirmed GPS to be two folder systems established interagency GPS management board to continue it as general asset.

With the European community ,the US government agreed to continue relationship towards GPS in 2004

Navigation positioning and timing management has been updated by US president George W.Bush in executive board.

Modern GPS satellites have been introduce for better usage in 2005.

Then after latest GPS satellite has been introduced in march 15th 2008

In December 10, 1990 one of the GPS has become effective but it is still in working.


Deccan navigator has been introduced in the Second World War in 1940's.

It is mainly based on the radio navigation system.


GPS main responsibility to estimate its position with regarding to timing of indications directed by GPS satellite which is distant beyond from this way every satellite constantly delivers the message enclosing the time for transferring these messages.

Whereas GPS has launched US defense department (D.O.D) and which it has been initially run with 24 satellites.

Previous navigation systems are worst to overcome from all these features GPS satellites has been introduced in 1973.Mainly designed by three parts

1. Satellites orbiting the earth.

2. Control and monitoring stations on earth.

3. GPS receivers owned by users.

GPS receivers main function is its identifies GPS satellites signals from universe.

Three dimensional position (latitude, longitude and altitude) and time delivers by the each GPS receiver.



Generation of electricity and power channelize are finished at similar time for this resolvation and it is vital for electrical companies.


By using GPS among two points distance has been estimated.


Traffic jams has been measured by using GPS and every minute information has been informed to driver.

Tale contour has been introduced which enables traffic manager.


Exact data for marketing polices and advertisements has done by utilizing GPS.


By doing GPS tool we can rise more security to our environment


Schools of fishes easily we can catch up by using GPS.

To survey the land in farming industry GPS has been used and it is used for automatic steering.


By using GPS we can preserve exact timing system.


Large amount of water bodies has been predicated by using GPS and whether forecasting has been calculated according to the climate changes.

It gives more data to metrologists to implement good service.

2.1 SMS

2.1.1 Explanation

The full form of SMS is short message service. This short form is been using in the communication technology. SMS is used to send messages from one mobile to another mobile's. The digital networks are used to send and receive SMS.

The use of the SMS service not only used in the mobile messaging services but also used in computer to send messages from computer's to mobiles by using SMS software through public gateways.

There are two types of SMS:

(SMS-MT) Short message mobile terminated

(SMS-MO) Short message mobile oriented

The data which are been sent will be limited like 140 bytes , so the message contains,

70 characters if the 16 bit Unicode UCS encoding is used and non Latin alphabets such as Arabic and Chinese are used.

160 characters if it is a 7 bit character encoding is used and Latin alphabets are used.

By using SMS service not only texts but also send like symbols, logos, business cards, ringtones, wallpapers to the mobiles. This messaging service will support almost all type of GSM mobiles and the cost of each message is less almost in all the services.

Now a day's everyone using the mobile phones. No matter where the user is at home, business or at journey, the message which been sent will be delivered to destination mobile. If the mobile user is not in the coverage area or switched off, that message will be stored with the operator service. When the user will enters to coverage area or if he switch on the mobile the message will be delivered. From the last 10 years the usage of the SMS is increasing. In 1999, around 3 million messages reached. SMS is similar to paging. The other name of SMS is store and forward service. The messages won't be sent from the service centre to destination user directly, there will be some message centres will be present between source and destination. The message will transfer through the message centres and reach to the recipient.

The mobile telephone networks that are going to send SMS centre's will be one or more message centre's which are going to handle for sending the messages to the destination user. SMS has an additional feature other than the pagers that has message delivery confirmation characteristic. i.e, when the sender sends a message from a mobile phone that message is received or not received by the destination user will get the delivery status, whether the message is delivered to the user or not.

2.1.2 SMS technologies

In Global system for mobile communication (GSM) messages will sent to the mobile and receive to the mobile as well. By using SMS Expansion and compression techniques the numerous messages will be transfer. In SMS compression all the 160 characters of the information will form to a single short message by using the two methods in which the SMS are sending and receiving simultaneously.

2.1.3 SMS newest developments

Now a day's message has been become a contact among the persons. So anything that simplifies in transferring the messages is going to be a vital enabler of SMS. In these developments mainly analytical test input's considerably decreases the figure of input strokes will completed to send a messages so T9 from topic generates the word with what the customer is trying to produce. the extensive of such analytical texts T9 in to the mobile phones by installing them will naturally up leads to an regular fortify of 25% per person customer in an SMS transfer. These prognostic texts are going to bear for numerous languages. Protocols are used in SIM application toolkit and Wireless Application Protocol (WAP) quickly increases in SMS messaging service usage by only if a standard check growth and industry limit. By using the protocols the consumer's can be with no trouble gives reply to and easy to get to messaging services through suitable menus on the mobile. They will lead up to 10 to 15 percent fortify in messaging services.

Messaging services usage is increasing speedily because of user friendly terminals. Terminals like smart phones makes it easier for customers to write and give respond to otherwise accessing messaging services using the keyboard other than mobile phones having imperfect keypad.


When comparing with the rest of the world and USA the SMS service is inattentive.The reason behind ,the SMS serviceslow in USA because relaxely they get off which they were not aware of digital wireless board i.e important for SMS to operate.Nokia,motorala and Ericison are SMS enabled devices.SMS techonology has been uploaded on them to access at present days.In USA GSM techonology is growing but it is very slow compared to other countries.

By using GPRS(general packet radio service)we can send large length amount of message.These GPRS connection has been overcomed by GSM connection.It has high speed compared to other techonolgies.GSM sending the text message is 9600 bit per second and where as GPRS text messaging at a speed of 100,000 bits per second.


For both consumers and operators SMS globally has made huge successin this fast moving techonolgy.It is giving better service to the consumer after a long time period.

Which the SMS has made huge success in telecom department for its non -voice service.Main reason behind for success is low cost ,simplictyand delivers the text message for an accurate distance.

In UK GSM networks in 2002 the operating SMS service has reached nearly 16.8 billion present people using mobile device main purpose of texting of message onlyand it has been reached nearly 70%of the phone end users.

Various types of news can be seen mobile phones like marketing,advertsing,whether forecasting and political suing MDAs professional text service,several tariffs given to the costumers in using SMS service .Business sectors has been increased rapidly with huge increase of SMS service.In global markets estimation has been calculated due to large growth of messaging industry revune and due to it's fast service in life cycle.

2.1.6 History

In 1980's only there was an idea of adding the text message service feature for a mobile was there in many communities of mobile communication services.

The first plan was held by CEPT group and it was approved in December 1982 by GSM.

This target made inter change of text messages directly between mobile stations, since 1980s these are widely used.

Now a day's there was a rapid increase in the usage of SMS according to the mobile data association (MDA) recent report on mobile usage in UK.

This report includes a synopsis of total number of SMS sent over past few years. The details are given below:

In year 2008: 77.2 billion

In year 2007: 54.8 billion

In year 2006: 44.3billion

According to the statistics of mobile message analyst the income from standard and best rated messaging was 82 billion dollars in 2008. From this the mobile income is forecasted to produce and can be available of 110 billion dollars by 2013.


Test contents ,pictures and audio files are combinely known as MMS message .with the help of MMS service we can transfer a rich MMS with low cost to users ,with the maintance of respective operatives which we use. Test, images and photos combinely send to user with great feel by using MMS service.

With the help of advance multimedia platform several number of users can access different technologies which is opened globally.

In GPRS market ,MMS service plays an important role .Here MMS messages are sended similar to that of SMS,when the content was sending ,message was prearranged first and these prearranged was injected into a text message .Which the text message send through MIME email.

By using MMS server the message has been carried forward if the user is another carrier, the forwarded message has been sent through the internet .With the help of "Content adaptation" or MMSC, the whole MMS message can be converted according to the end user.


To send pictures, audio or if we need to edit the MMS message, the mobile phone should have to be better capability. We can share our personal images or experience. When we get a relaxed time, which it shows whole new scopes in determining our can be simulated through email user like transmission MMS from mobile to mobile as well from MMS from mobile to internet access.

By this service MMS has brought lot of changes in the world globally to the customers.

By extremity services MMS is implemented in all networks and it looks like normally SMS format default in some devices it shows like MMS mode and it consists of GIF and 3PEG and picture formats.

In modern technology i.e., GSM network MMS service is meet to uplift the service.


In 1990 by extending the SMS system or to add some features Ericsson has been projected. At that time2G GSM is on-going technology is evolved into 2.5GPRS to do quick performance .By this propose the message boundary had did not make any change.

In 3GPP Technology SMS principles has been extended into any length of message .Real time media and for files MIME support has been added. To maintain media it becomes difficult so WAP standards are added to this way MMS has been introduced in March 2002 by Telenor.

In year 2009:783 million

In year 2008:586 million

In year 2007:448 million



The Aim of MMS/SMS application is intended to send and receive MMS images from one mobile emulator to other. It gives an option to select from a list of images to send. With the SMS application it is possible to send and receive text messages from one mobile emulator to other.

The project has three modules

SMS Application

MMS Application

Google map on mobile using GPS Receiver

Option a) & option b) are kept in mind that MMS/SMS applications have to be. These are separate applications and have to be executed on different emulators. When creating the project in the properties section you need to select different emulators so that they do not get overlapped during execution. This has also being implemented using Bluetooth enabled devices. There are no limitations pertaining to hardware (time, space), software technologies to be used are pertaining to J2ME API's and networking requirements. You can consider this document as an operational one also. If an incorrect phone number is entered then an alert error message is provided to notify the user.

The option c) is on working with Google map via GPS receiver. The Global Positioning System (GPS) is a U.S. space-based radio navigation system that provides reliable positioning anywhere on or near the Earth. GPS provides accurate location and time information for an unlimited number of people in all weather, day and night, anywhere in the world. Here we are going to get accurate position on earth through GPS receiver and through which going to get the Google map on mobile using Google map API key.

Future Work


Aim of project is to develop an application on SMS/MMS/GPS

Learn to work on J2ME technology & IDE Netbeans 6.9.1

To understand the entire real life project development work flow

Reasons for the This Project

CHAPTER 4: code Implementaion

Life Cycle of a MIDlet

All application in J2ME extends MIDlet Class. MIDlet class manages the complete life - cycle of an application. Its Package name is javax. microedition.midlet.

MIDlet can be compared to Applet in J2SE. A MIDlet has four states:





Below we can notice the MIDlet life cycle. When a MIDlet is transferred in to a mobile, a constructor is called & it remains in loaded state. It can happen at any point of time before the program starts the application by invoking the startApp () method. After this the application is in waiting state until unless the program manager calls pauseApp () or destroyApp (). PauseApp () pause MIDlet, and desroyApp () destroy the MIDlet.


It initializes an MIDlet application.

pauseApp ()

While your application is in paused state it releases all resources & stop animation. It benefits in two ways

Avoid resources use confusion

Unnecessary Battery consumption


It destroys the MIDlet.

How to make a new MIDlet application

First of all you need to download the netbeans 6.9.1.Now you need to install the netbeans on your system.

Now we are done with the system requirements & software requirements to build our ready with required software which can build mobile applications in java.

1. Open Net Beans-IDE

2. Click on new project

3. Select option of java ME project & on right side select "mobile application"

Put the project name & location

Select the Emulator platform, Device, Device configuration & Device profile

6. Click on finish

After all the above process is done the project folder will be created with the name of Academic Project what we have given earlier.

When we click a right click on the project folder we will get options

Select new and in that select MIDlet, after selecting the MIDlet

Whatever we want to display on the screen we will write that code in startApp (), pauseApp () & destroyApp ().


To send & receive SMS between two mobiles.


Netbeans 6.5.1

Java and J2ME() [JAVA(TM) Platform Micro Edition DSK 3.0]

CLDC 1.1 and MIDP 2.0

Explanation of SMS (Short Message Service) code

Module associated with receive SMS


It has the class to receive the text message.

Module associated with sends SMS:


It has 3 classes under its section SMS_Sender, Validate & PhoneNumberException. Again there is exception handling related to handling of incorrect phone number.

SMS Receive

The folder hierarchy will be like this file

Package name:

package com.sms_reciever;

Packages to be imported:

import javax.wireless.messaging.*;// used for the connection establishment and To send the text messages. Provides for the Environment to send the text messages.

import javax.microedition.midlet.*; // Makes MIDlet class available

import javax.microedition.lcdui.*;// to use the attributes like form, display etc

import*; //It does the input/output operation

SMS_Reciever extends MIDlet class and implements CommandListener:

public class SMS_Reciever extends MIDlet implements CommandListener{

//These are the forms, Command, Displayable & Display references are taken:

protected Form frm; // generate a form

private Command cmd_exit; //generate an exit button

protected Displayable displayable;

protected Display disp; // interactive Application get interaction

//with the display by obtaining instance of Display class

public SMS_Reciever() { // Contructor for SMS_Reciever class

disp = Display.getDisplay(this); // Generates an display object that //gives access of Display to the application

frm = new Form("Multimedia Messaging Service");// generates a form //with this heading

cmd_exit = new Command("Exit", Command.EXIT, 1); // creates Command //Button with exit command

frm.addCommand(cmd_exit); // adding exit button to the form

disp.setCurrent(frm);//set this form "frm" as a front page on screen


startApp() method starts the MIDlet

public void startApp() {

disp.setCurrent(displayable); //displayable is something that can be displayed on the Display. But Display is related to hardware

Message message = null;

String address = "sms://:50000";// This is the default port number

System.out.println("Connection setup started!!!");

try {

MessageConnection msg_connection = (MessageConnection) // To create the SMS Connection to receives messages;

System.out.println("Connection Done!!!");

while (true) {

message = msg_connection.receive(); //it receives the message text and store it in message

System.out.println("Starts message recieving!!!");

if (message instanceof TextMessage) {

TextMessage msg = (TextMessage) message;

String text = msg.getPayloadText(); //message has uploaded now to convert it to simple text call "getPayloadText()" method

String str = "Msg Recieved";

frm.append(new TextField(str, text,50, TextField.ANY)); // this will display the message on screen



} catch (Exception e) {




It is used for the pause of MIDlet

public void pauseApp() {


This is for the destruction of MIDlet

public void destroyApp(boolean b) {

disp = null;

displayable = null;


public void commandAction(Command c, Displayable d) {

if(c == cmd_exit){






SMS Send

This Midlet file will be used in sending of the messages.

package com.sms_sender;

import javax.microedition.lcdui.Display;//interactive Application gets interaction with the display by obtaining instance of Display class

import javax.microedition.lcdui.Displayable; //displayable is something that can be displayed on the Display. But Display is related to hardware

import; // For I/O exceptions during

import javax.microedition.lcdui.Command; //it makes command buttons like exit, add, send etc

import javax.microedition.lcdui.CommandListener; //it recieves high level events from implementaion

import; // To establish the connection for communicaion

import javax.microedition.lcdui.AlertType; // It generates Alert message.

import javax.microedition.lcdui.Form; // Makes form available

import javax.microedition.lcdui.Alert; //It generates Alert message.

import javax.wireless.messaging.MessageConnection;// To create the SMS connection Over the address specified.

import javax.wireless.messaging.TextMessage;// Text messages make available

import com.sms_sender.SMS_Sender.*;

import com.exceptions.PhoneNumberException;// Throws Phone Number Exception

import javax.microedition.lcdui.TextField; // can access TextFields

import javax.microedition.midlet.*;// Makes MIDlet class availble

public class SMS_Sender extends MIDlet implements CommandListener {

// does have coding of SMS sending

private Validate validate = new Validate();

private Display disp; ;//interactive Application gets interaction with the display by obtaining instance of Display class

private Command cmd_send;//create a button "send"

private Form frm;// generates a form

private Command cmd_exit;//creates an exit button

private Alert errorMSG;// an error msg

private TextField Pno, msg;// creates a text field

private int portNo = 50000;// port number to communicate

public void setPort(int portNum) { // sets a port number to send messages

System.out.println("set PORT called ...");

this.portNo = portNum;


public TextField getPhoneNumber() {

return Pno;


public void setPhoneNumber(TextField phoneNumber) { // sets phone number in text field on screen

this.Pno = phoneNumber;


public SMS_Sender() { //constructor for SMS send with initialization of variables

frm = new Form("SMS page");// Form name

disp = Display.getDisplay(this); // Current display screen

cmd_exit = new Command("Exit", Command.EXIT, 1);

frm.addCommand(cmd_exit);// exit button creation

cmd_send = new Command("Send", Command.SCREEN, 1);

frm.addCommand(cmd_send);//add command button

Pno = new TextField("Phone Number :", "", 40, 0);//Text field to enter the phone number

frm.append(Pno);//embid this phone number text field to the form

msg = new TextField("Enter Text :", "", 40, 0);// textfield to write the message


frm.setCommandListener(this);//listens command of current button pressed

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

errorMSG.setTimeout(5000);//message should be sent within 5 seconds only


public void commandAction(Command command, Displayable displayable)

{// this method listens the command button order

if (command == cmd_exit) {



} else if (command == cmd_send) {

try {



System.out.println("SMS Sent!!!");

} catch (PhoneNumberException e) {


} catch (IOException e) {





public void sendSMS() throws IOException, PhoneNumberException


String str = Pno.getString();//phone number stored is again stored in string format

if (validate.isValidPhoneNumber(str) == false)


errorMSG.setString("Entered Phone Number is wrong!!!");


throw new PhoneNumberException();


//open the msg connection...

String addr = "sms://" + str + ":" + portNo;

MessageConnection con = null;//Does the connection to send message

con = (MessageConnection);

TextMessage message = (TextMessage) con.newMessage(MessageConnection.TEXT_MESSAGE);






public void startApp() {



public void pauseApp() {


public void destroyApp(boolean unconditional) {



MMS Receive


To develop an application to send MMS from one mobile to another mobile.


Netbeans 6.9.1

Java and J2ME() [JAVA(TM) Platform Micro Edition DSK 3.0]

CLDC 1.1 and MIDP 2.0

MMS (Multi Media Message Service) code explantation

MMS Recieve

The hierarchy of folders is cat

This file does the task of receiving messages from another emulator.

package com.mms.mmsReceiver;

import javax.microedition.lcdui.Displayable;

import javax.microedition.midlet.*;// makes MIDlet parent class available

import javax.microedition.lcdui.CommandListener;//to generate command listening

import javax.microedition.lcdui.Display;

import javax.wireless.messaging.MessageConnection;// makes connection object to comminicate

import javax.wireless.messaging.Message;

import javax.wireless.messaging.MessagePart;// holds message in parts


import javax.microedition.lcdui.Command;

import javax.wireless.messaging.MessageListener;

import javax.wireless.messaging.MultipartMessage;

import javax.microedition.lcdui.Form;

import javax.microedition.lcdui.Image;


public class MMS_Receiver extends MIDlet implements MessageListener, CommandListener {

private Display disp;// does create a reference to make application to get access of Display

private Displayable displayable;//the actual module that gets displayed on screen

private Command cmd_exit;// exit button

private Form frm;// form creation

MessageConnection con = null;// makes a connection refernce

public MMS_Receiver() {

disp = Display.getDisplay(this);// get display of current form

String s = "MMS Server";

frm = new Form(s);// makes a new form with "MMS Server heading"

disp.setCurrent(frm);//set Current form on front


public void ImgMMS(Image img) {

frm = new Form("Image Recieved!!!");

disp = Display.getDisplay(this);//uses current display object

String s = "Exit";

cmd_exit = new Command(s, Command.EXIT, 1);

frm.append(img);//sets the images received on screen

frm.addCommand(cmd_exit);// exit button

frm.setCommandListener(this);// acts as per whatever command generated



public void startApp() {


String mmscon = "mms://:50000";// port number to communicate

try {

System.out.println("Getting Connection!!!");

con = (MessageConnection);


System.out.println("Connection Done!!!");

} catch (IOException ioe) {



frm.append("Wait for MMS!!!");


public void pauseApp() {


public void destroyApp(boolean unconditional)


disp = null;

displayable = null;





} catch (IOException e) {



public void recieveMSG()


try {

Message message = con.receive();

if (message != null) {

if (message instanceof MultipartMessage)


MultipartMessage msg = (MultipartMessage)message;

MessagePart[] subparts = msg.getMessageParts(); //get messages in parts

if (subparts != null)


System.out.println("Got some part of msg!!!");

for (int cnt = 0; cnt < subparts.length; cnt++)


MessagePart m = subparts[cnt];

byte[] b = m.getContent();

System.out.println("Msg Bytes..");






Image image = Image.createImage(b, 0, b.length);// fixing the size of image on screen


System.out.println("Img created!!!");



} catch (IllegalArgumentException e) {}





} catch(IOException e) {



public void commandAction(Command command, Displayable displayable){

if(command == cmd_exit)






public void notifyIncomingMessage(MessageConnection conn) {

System.out.println("Inside Notifier !!! ");




MMS Send

This is the hierarchy of MMS Send module file does throws the exception generated incase of some phone number error.

package com.exception;

public class PhoneNumberException extends Exception {// Exception class . It tells if Phone number entered is wrong it will throw an Exception

public PhoneNumberException() {

this("Invalid Phone Number!!!");


public PhoneNumberException(String message) {




It does have image storage in a vector. It does work on image part.

package com.mms.mmsSender;


import java.util.Vector;

import javax.wireless.messaging.MessagePart;

public class AddParts {// It does add images option on the screen// make a stack of images

private String[] str = {"teddy.jpg","flowers.jpg","fruits.jpg"};

public MessagePart[] getParts(int i)


Vector vector = new Vector();



vector = addPart(i);

}catch (Exception e) {



MessagePart[] msgPart = new MessagePart[vector.size()];


return msgPart;


public Vector addPart(int i) throws Exception {// return a stack of images


Vector vector = new Vector();System.out.println(1);

int cnt = 0;

MessagePart msgpart;System.out.println(2);

String resouce = str[i];System.out.println(3);

System.out.println("Selected Resource is :" + resouce);System.out.println(4);

String mimeType = "image/jpg";System.out.println(5);//images storing extension is JPG

String image = "/image/" + resouce;System.out.println(6);

InputStream inputstream = getClass().getResourceAsStream(image);System.out.println(7);// get the complete image in stream form only

byte[] contents = new byte[inputstream.available()];System.out.println(8);;System.out.println(9);//read the complete byte stream of image

msgpart = new MessagePart(contents, 0, contents.length, mimeType, "id" + cnt, "contentLocation", null);


vector.addElement(msgpart);System.out.println(11);// add the images to the vector


return vector;


} MIDlet is used for MMS sending

package com.mms.mmsSender;



import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

import javax.wireless.messaging.MessageConnection;

import javax.wireless.messaging.MessagePart;

import javax.wireless.messaging.MultipartMessage;

import com.exception.PhoneNumberException;

import com.mms.mmsSender.AddParts;

public class MMS_Sender extends MIDlet implements CommandListener {//This class Is the complete module of MMS sending

private Command cmd_exit;// exit button creation

private Command cmd_send;//send button creation

private Display display;// display object

private Form frm;

private TextField phNo;

private String[] img = { "Teddy","flowers","Fruits"};// string array of images

private ChoiceGroup cg;

private MMSSend mmsSend = new MMSSend();

private AddParts parts = new AddParts();

private int portNum = 50000;// port number to communicate the application

private Alert errorAlert;

public void setPort(int portNum) {

System.out.println("Setting port!!!");

this.portNum = portNum;


public MMS_Sender(){

frm = new Form("MMS");

display = Display.getDisplay(this);

cmd_exit = new Command("Exit", Command.EXIT, 1);

cmd_send = new Command("Send", Command.SCREEN, 1);

cg = new ChoiceGroup("Select Image", Choice.EXCLUSIVE, img, null);


phNo = new TextField("Phone Number :","",40,0);





errorAlert = new Alert("MMS", null, null, AlertType.ERROR);

errorAlert.setTimeout(5000);// message to be sent in 5 secs only


public TextField getPhoneNumber() {

return phNo;


public void setPhoneNumber(TextField phoneNumber) {

this.phNo = phoneNumber;


public void startApp() {



public void pauseApp() {


public void destroyApp(boolean unconditional) {


public void commandAction(Command c, Displayable d){

if(c == cmd_exit){



} else if(c == cmd_send) {

try {

System.out.println("Send MMS!!!");



System.out.println("MMS Sending successfull!!!");

} catch (PhoneNumberException mms) {


} catch(IOException e) {





public void sendMMS() throws IOException, PhoneNumberException {

String number = phNo.getString();

if (mmsSend.phoneNumberValidation(number) == false) {

errorAlert.setString("Phone Number entered is wrong!!!");


throw new PhoneNumberException();


int index = cg.getSelectedIndex();

String address = "mms://" + number + ":" + portNum;

MessageConnection mmsconn = null;

/** Open the message connection. */

mmsconn = (MessageConnection);

MultipartMessage mmmessage =(MultipartMessage) mmsconn.newMessage(



MessagePart[] parts =;

for (int i = 0; i < parts.length; i++) {



mmmessage.setSubject("MMS Text");


if (mmsconn != null) {




} is used for phone number validation

package com.mms.mmsSender;

import com.exception.PhoneNumberException;

public class MMSSend {

public boolean phoneNumberValidation(String pno) {

System.out.println("Validation starts!!!");

char[] chars = pno.toCharArray();

if (chars.length == 0) {

return false;


int startPos = 0;

if (chars[0] == '+') {

startPos = 1;


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

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

return false;



System.out.println("Done Validation!!!!!");

return true;



CHAPTER 5: Testing

Software Installation

The following software's are required to test and run this Project

Java JDK 5.0 or Higher:

The standard java platform is required for running the Projects. The latest version can be downloaded from

Netbeans 6.9.1 or higher is required to run the system. Net beans installation is given below

To Install Netbeans

Netbeans installation instructions are available at

We will need to download the netbeans software from

When prompted for features are to best to choose Java. The Java option provides several tools for developing Java Standard Edition, Java Enterprise Edition and Java Mobile Edition applications. This download option also includes links to download GlassFish v3 Server, and Apache Tomcat 6.x Server software which is useful for developing enterprise Application

For our Project it is the Java ME edition that matters. After the download finishes we will need to double click the .exe file and follow the wizard. The Wizard asks the following information

License Agreement

Location of JDK installed

Glassfish and/or tomcat installation path (not applicable for our project)


After the installation is complete, Net Beans IDE is available under Program Files. The Project can now be opened or a new J2ME project can be created here.

In the Project Properties window it is essential to choose CLDC 1.1 and MIDP 2.0. This will ensure the MMS, SMS and GPS all work fine.

Please note I need to make sure that the device you need to run it on needs to be compatible with the Above Profile. You can check the same from Settings.

A Sample Configuration show in a Blackberry looks like

Blackberry ® 8320 Smartphone (EDGE, Wi-Fi) v (Platform

Cryptographic Kernel v

Micro Edition Configuration : CLDC 1.1

Micro Edition Profile : MIDP 2.0

Micro Edition JTWI Version : 1.0

5.4 Connecting Our Phone to a PC

To Connect the Phone to the PC you have two options

You can use a USB Based cable provided by the Telephone Manufacturer

Connect you phone to the USB

You should be prompted for an Installation Wizard based on the Cell Phone Type

Follow the instructions to install the Driver.

You might need to have a CDROM provided with the Phone handy for this

The other method to connect to the phone is using Bluetooth. This option is available only if your phone is Bluetooth enabled. If your Computer does not have a Bluetooth adapter you can buy a Cheap Bluetooth Dongle and connect it to the USB of your machine.

Follow the instructions below for Bluetooth Connectivity

Enable Bluetooth on your Phone

Set the Bluetooth Options to Pairing Mode

Set the Discoverable Option to - Discoverable

Double click the Bluetooth Icon on the system tray on your PC

Click on Search for Devices

The Search should list your Bluetooth Phone.

Click on connect/pair

It should ask for a PIN. Create a PIN and hit next

On the Phone you will be prompted to enter the PIN. Enter the same PIN and hit OK

You should receive a confirmation that your pairing is complete

Bluetooth connectivity is complete.

For connecting a Bluetooth GPS Adapter follow the same instructions as above. However when prompted for PIN choose the PIN Less method. Since the L2CAP/SRP adapter does not come with a Screen and buttons you cannot have a PIN based authentication with it.

Installing Application on Our Phone

In order to install the application on phone you will need to follow two steps (we are assuming you are doing Bluetooth based transfer. If using a cable use the instructions provided by the manufacturer)

Enable Bluetooth on your Phone

Make sure that Your Phone is configured to receive files using Bluetooth. On Some models this can be done from the File manager

Copy the jar and jar file to the phone:

You can find these two files in your Projects DIST folder after compilation is down successfully.

Open the path in a Windows Explorer Window

Right Click the File and click Send > Bluetooth Device

Follow the instructions and click next

Once you see the files in your cell phone open them. Normally an installer wizard should start immediately

Once installation is complete you can see options on your Cell phone home screen or applications menu from where you can launch it.

CHAPTER 6: Results & Images

SMS Module Testing

When application gets compiles and build set the SMS Receive module as a main. And run it. It will give SMS_Recieve option.

Same way select the SMS_Send module as a main. Compile and run it. It will give this screen that needs to fill phone number and whatever message you want to leave.

To select the character format go to menu click on "Qwerty". It will give the following options. Select "abc" that will take character options only.

Enter the Phone number of receiving Emulator & text the message in sender mobile. Click on send button .The Receiving mobile will receive the message this way.

MMS Module Testing

Compile and run the MMSSend module but first set it as a main project. We get an option of MMSSend on screen.

Same way compile and run receiving module even with different emulator. It shows MMS_Recieve option. Click on center button

Select the picture option from the sender mobile and enter the number of receiving mobile. And click on send button

CHAPTER 7: Conclusion

From this project I concluded the application is developed to send SMS and MMS regarding J2me programming by using net beans 6.9.1 software .In this project various type of research has done in developing the software application and this application practically proved on laptop which they are SMS and MMS.After testing the SMS and MMS i.e sending SMS from one mobile to another mobile. From all the above fundamentals which I summarized the j2me application in mobile devices.

CHAPTER 8: references