Date post: | 28-Dec-2015 |
Category: |
Documents |
Upload: | gyles-booth |
View: | 219 times |
Download: | 1 times |
Java Mobile Application
sms,sim,mms and barcode application
Presented byAyedh(SIM
and MMS)Asad(SMS and
Barcode Application)
Introduction All network accesses in MIDP devices work
through Generic Connection Framework. According to MIDP 2.0 specification devices
must support HTTP and HTTPS connections. It promises any mobile application to be done
more securely connected to the Internet.
Different components of connections There is a one class connector and 7
connection Interfaces
http://www.j2medev.com/api/midp/javax/microedition/io/package-tree.html
GSM Cell broadcast overview
Making a connection Pass a connection string(URLs with a
protocol,network address and optional parameter) to one of the Connector’s open method.
Connection is not useful by itself,so you must cast the return value..
HttpConnection hc=(HttpConnection)Connector.open(url);
It hands you back some connection implementation.
You can use that to get input and output stream.
Clean upprivate void loadBytes(String url) throws IOException{HttpConnection hc =(HttpConnection)Connector.open(url);
try{
InputStream in=hc.openInputStream();try{
//read data from in.}
finally{in.close();}
}
finally{hc.close()}
}
SMS SMS and MMS are most popular facilities since
the advent of 2G mobile telephony Wireless Messaging API is a bridge
between the MIDlets and the text and Multi Media Messaging
Java ME supports short text ,binary and multipart message on the wireless messaging API
Jsr205 is the wireless messaging API 2.0 which adds support for multi media message service and replaces the early API jsr120.
Why messaging SMS and SMS are travelled through store-
and-forward network, which means messages are not lost even if the destination is not available.
They don’t involve a server. you can easily communicate between applications running on different devices with no server side programming.
Commercial values Value of SMS per year around the world? $100 bn How big is that? Take all of hollywood
movie box office revenues worldwide. Add all of the global music industry revenues. And add all of videogaming revenues around the world. Even all those three together, we don't reach 100 billion.
SMS reaches 3bn people - 2x more than TV, 3x more than internet
Steps for sending a message
public void sendText(String address,String text){String cs=“sms://”+address+”:50000”;MessageConnection
mc=(MessageConnection)Connector.open(cs);TextMessage
tm=(TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE);
tm.setPayloadText(text);mc.send(tm);}
contd……
Steps…… Obtain MessageConnection from
Connector Get a new message from
MessageConnection calling newMessage(); Fill up the message.Here in the example
setPayloadText() is specific to a Textmessage.
Send the message by passing it to the MessageConnection’s send() method.
Receiving a messageMessageConnection c;C=(MessageConnection)Connector.open(“sms://
50000”);Message msg=c.receive();If(msg instanceof TextMessage)msg{//handle message}
Two ways to receive message Create a thread that loops on calling
MessageConnection’s receive() method. Secondly by using MessageListener.You
supply the listener and register with the MessageConnection.Whenever the message arrives ,listener’s notifyIncomingMessage() is called.Then you call the receive() method knowing that a message is waiting.MessageConnection gives you a message.
Barcode ApplicationIt is an emerging technology.
User can scan the bar code and almost immediately user will get the product details.
Usefulness During shopping user can compare the
price by scanning barcode of the product through internet.
User can down load the ring tone , picture, music in music store.
User can bid on e-bay
Steps to get barcode application on phone Get the free software from the internet. Download the software to a cell phone
with camera. It is ready to use . Take a picture of any barcode with the
camera and you can get the product details.
MMS Next generation of SMS. JSR205,WMA 2.0 ,adds support for MMS
with the MultipartMessage class. It keeps track of multiple addresses,a
message subject and some number of MessageParts,which are essentially file with associated content type.
Exact size limit on MMS depends on the phone and the carrier. Max is 100KB
Example: Send MMSPublic void sendMultipart(Stringaddress,String
subject,MessagePart[] parts){String cs=mms://+address+”applicationIdentifier”
MessageConnection mc=(MessageConnection)Connector.open(cs);
MultipartMessage mm=(MultipartMessage)mc.newMessage(MessageConnection.MULTIPART_MESSAGE);
mm.setSubject(subject);for(int i=0;i<parts.length();i++)mm.addMessagePart(parts[i]);mc.send();
}
MMS in brief It looks same, get a MessageConnection,get
message,populate it and send it. Connection string starts with mms and it includes
application identifier (more reliable). Application identifier=an inverted domain
name+an application name and the size of AI can be a maximum of 32 char.
U can use addAddress() in MultipartMessage to add more address.
Each multipart message has a content type,a content ID,an optional location and an optional encoding scheme.ContentID should be unique for each part of multipart message.
SIM Card Application
SIM Card (Subscriber Identity module) What is SIM card? SIM Card Specification. SIM Operating System. Nice thing with SIM Card application Examples.
SIM Card Part of smart card ICC for mobile phones 2-types of SIM Cards:
1- credit card size 2- phone card
SIM OS: JAVA Card Native OS
Data Stored in SIM Card Subscriber identity. SMSC (Centre). SPN: Service Provider Name
Nice thing with SIM application For Operator: deploy the application to all
subscriber easily For Application provider: SIM card is a standard environment
regardless of brand, age or features
Example Call management application: enable you to send an automatic
message or call back people who tried to reach you while you are unavailable.