Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Deploy Your J2ME Application on a Sprint Phone : Page 4

Web server configuration and caching problems are just two of the obstacles you'll need to overcome when you deploy Java applications on cell phones. This article provides the workarounds and solutions you'll need to overcome these bumps.


advertisement
Fun Things with JAD
Now that you've expedited OTA Provisioning to our handset without any caching problems and you know what a MIDlet suite is comprised of you can begin to have some fun. More specifically, I'll demonstrate how you can add certain key-value pairs to the application's JAD file by using the KToolBar settings panel to specify optional and user-defined entries.

Remember that the manifest file inside the JAR partly mirrors the JAD file. That's why a tool like KToolBar can help ensure that the appropriate values are copied to both files. Consult the documentation if you're doing this manually.

Representing Your Application
Adding an icon to your application makes it stand out from the other applications on the phone, and it's really rather simple. First, create a PNG icon. If you're using KToolBar, put the file into the "/res" directory inside the project directory. Add the following entry to the JAD file:



MIDlet-Icon: /[path to icon]

The "[path to icon]" is a relative path to the file inside the JAR file.

Specify a description that will appear to the user upon installation. Add the following entry to the JAD file:

MIDlet-Description: A simple OTA Test Midlet

Replace it with a description that is appropriate for your application.

When I browse through the Applications folder of my LG5350, I can access a menu with the option to show me more information about the application I currently have highlighted. Wouldn't it be nice to send the user to a page with more information about that app and a link to other products you might offer? Well you can. Just add the following entry to the JAD file:

MIDlet-Info-URL: HTTP://webserver/SimpleMidlet_info.html

Replace the absolute URL with the one for your application.

You can also have the handset notify you that the user has successfully installed or failed to install the application on his or her handset. This is a great way of keeping track of how many people are downloading and trying out your application. And since extra information about the particular handset that made the request is provided as an HTTP request header, you can use this information to track on which phones your application is installed. The success code and a brief message are provided in the POST body of the request. Since the request headers also contain an identifier for the handset in the User-Agent field, you can use this information and the success code to identify which handsets successfully install your applications and which fail to install it. To enable this you add the following entry to the JAD file:

MIDlet-Install-Notify: HTTP://webserver/SimpleMidlet_install.php

A note of caution: this attribute is not included in the current MIDP specification, so consult the hardware manufacturer's specification to make sure this feature is supported on its handset. See the list of success codes in the OTA Provisioning Recommended Practices.

Some handsets will separate applications into different folders that are appropriately named for their content. My LG5350 automatically places applications I download via OTA into the Applications folder. But what if I wanted my application to be automatically downloaded into the Games folder? I'd simply add the following line to the JAD file:

Content-Folder: Games

You should, of course, replace Games with whatever category name is appropriate for your application. If the folder does not exist, the AMS will automatically create it.

Finally, one of the coolest things you can do with J2ME on Sprint phones is to create applications that can act as handlers for specific URI schemes or Internet Media Type handlers. This particular functionality requires the use of the Muglets API provided by Sprint. I'll explain how to use the Muglet API in my next article, but I'll explain briefly how to get started.

Say you've created an enhanced mail client and you want the application to handle mailto URIs in a Web page. Simply add the following line to your JAD and your application will be called whenever the user clicks on a link containing that URI:

Content-1-Handler: uri-scheme, mailto

You'll have to access the value passed through the Muglet API.

Finally, if you want to associate a file type to your application, add the following line to the JAD file:

Content-1-Handler: media-type, [mime/type]

Mime/type is the mime type of the file you want to handle.

Provisioning Perks
You can see that OTA User Initiated Provisioning has some unexpected aspects that, although not complicated to resolve, may be quite confusing when you first encounter them during testing and even deployment. Once you overcome them, however, you can start to take advantage of some of the features that a JAD provides. Although they may not make your application run faster (they certainly will not slow it down), extras like icons and Help URLs make your application look more professional to users. In addition, the ability to specify Media Type handling and URIs instantly provides a developer the opportunity to create some interesting applications.

Happy provisioning!



Robert Cadena is owner of factorysouth, a wireless application development company that creates handheld, wireless, and Web-based games for entertainment companies. You can reach him at robt.cadena@stanfordalumni.org.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap