|
The Openwave Mobile SDK provides developers with a series of practical articles about relevant mobile technology from the perspective of a fellow developer.
In this version our resident developer, Luca Passani, discusses WAP Push (below). The previous installment provided a discussion on XHTML/CSS, client/browsing technology, and relevant Open Source projects. WAP PushOpenwave® Mobile SDK We have added WAP Pust to our latest release of the Openwave Mobile SDK. WAP Push in its simplest incarnation is about sending a message to a subscriber and a hyperlink to their browser. If the subscriber finds the message interesting, they will tell their browser to go and grab the page the links points to. This means that you can drive more traffic to your service, as long as your content is cool enough.Let's look at this example to understand what the user experience with WAP Push looks like. One major European soccer team beats another one in an important semi-final. Most soccer enthusiasts all over the world will find this interesting no matter which team they support. Getting the details, pictures and possibly a video clip of the match is only one click away.
WAP Push is about sending the text and the link. In the Openwave Mobile SDK, you will find all the info and the software you need to get started. In the first issue of the Mobile SDK we focused on XHTML MP and we introduced some sample applications to show XHTML MP in action. The Peer2Park application hinted at the use of WAP Push to notify buyer and seller of a parking spot. In this issue, we have turned the static XHTML sample into a real WAP Push application: if you install the code on this CD and you provision your push-enabled phone on our gateway, you will be able to programmatically send push messages (also called SI, Service Indications, in WAP Push speech). The following picture shows what WAP Push looks like to you. Your web server is using PAP (Push Access Protocol) to pass the service indication (a small XML file with the link and the text of the message) to the PPG (Push Proxy Gateway), which in turn will send it to the device.
The good news is that Openwave provides you with a free Java WAP-Push library that protects you from having to learn the details of the PAP protocol. Install the push-library on your system and pushing messages becomes as simple as:
:
import com.openwave.wappush.*;
:
public void SubmitMsg() throws WapPushException, IOException,
MalformedURLException {
//declare ppg url, recipient address, push message ID and SI url
String ppgAddress = "http://" + host + ":9002/pap";
String address =subno + "/TYPE=USER@www.openwave.com";
String SvcIndURI = "http://demo.phone.com:8080/location/servlet/buyerAlert?time="+sell;
String pushID = Integer.toString((int) (Math.random()* 1000000000));
URL ppgURL = null;
URL siURI = null;
ppgURL = new URL (ppgAddress);
siURI = new URL (SvcIndURI);
//instantiate the PPG object
Pusher ppg = new Pusher(ppgURL);
//this is the text string sent to the device
String alertText = "Spot at Broadway and Columbus St., SF, CA in "+ sell+" minutes";
System.out.println("Sell" + sell);
//instantiate the Service Indication object
ServiceIndication serviceIndication = new ServiceIndication(alertText);
//set the URI for this SI
serviceIndication.setHref(siURI);
//set the Service Indication action to signal-high
serviceIndication.setAction(ServiceIndicationAction.signalHigh);
//instantiate the push message object
PushMessage pushMessage = new PushMessage(pushID, address);
// Set the Quality of Service to high and confirmed always
QualityOfService qos = new QualityOfService();
qos.setDeliveryMethod(DeliveryMethod.unconfirmed);
qos.setDeliveryPriority(DeliveryPriority.high);
qos.setBearer("SMS");
// Set the QoS for the Push Message
pushMessage.setQualityOfService(qos);
MimeEntity me = new MimeEntity();
me.addEntity(pushMessage);
me.addEntity(serviceIndication);
//send the push message to the PPG
PushResponse pushResponse = (PushResponse) ppg.send(me);
//read some information from the Response
System.out.println("reply_Time = "+pushResponse.getReplyTime());
System.out.println("response-result-code =" + pushResponse.getResultCode());
System.out.println("response-result-desc ="+ pushResponse.getResultDescription());
}
Without going into too much detail, all you need to push a message is:
and then you are ready to rock and roll. You have probably observed that the location information remains static ("Spot at Broadway and Columbus"). That part will become dynamic too one day, not too far, when location-based services become a reality for developers. On that day, we will be there telling you how (for the time being, you can refer to the Openwave developer website). What about other technologies?Of course, XHTML is just the starting point. Wireless is more than browsing. It is also about delivering value, delivering fun and delivering emotions. Java games, WAP push, MMS and location-based services are the enabling technologies. Openwave is a leader behind all of these technologies and will give you the knowledge and the tools you need to be successful in the wireless arena:
Mobile Connections PartnersThere is more to Mobile SDK than simply Openwave's tools and documentation. You also have tools and resources from our partners. If you're wondering how this may be relevant to you as a programmer, it's simple: Once you develop cool applications, some of our key partners who aggregate applications and content may offer you an opportunity to participate in their portfolio of products they offer to operators and carriers. Be it technologies, APIs, or helping you find distribution channels for your applications and content, OMDT contains a treasure of resources you'll want to look at very closely. Open Source
Mobile SDK also contains relevant Open Source projects. In addition to time-honored Open Source pillars such as Tomcat, you will find two very interesting projects: OUI and WURFL.
|