
You can create a mobile version of your website that is compatible with most cell phones including Sprint's Vision handsets and Wireless Web browsers. Whether you need to find a hosting service or you can't figure out WML syntax, this guide will get you started. Soon you'll be provisioning your own ringtones and MIDlets.
MIME Types?
When a web server delivers a page to your browser, it also ships out a bunch of header information that you don't normally see. This header data precedes the web page and warns your browser about what's coming next. Included in the header is the MIME type. The Multipurpose Internet Mail Extensions type for most web pages is "text/html". A lot of cell phones don't understand HTML so I personally don't recommend trying to use it to run a mobile site. Sure, a lot of phones will process HTML reasonably well and a lot of sites are now using it, but if you want the widest audience then WML is your best bet.WML?
Wireless Markup Language is sort-of a light-weight version of HTML. I'll warn you right now, it's a pain. It's pretty limited compared to HTML. It's similar but different enough that you'll find it hard to switch back and forth between the two. I won't try to re-create a WML reference here. There are plenty of those on-line. As usual, I found the fastest way to learn was to look at some examples and copy them.Example
This is the WML for the ApGap home page:
<?xml version='1.0'?>
<!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="HOME" title="Mobile ApGap">
<p>
Welcome to the Mobile Application Gap.
</p>
<p>
Links:<br/>
1 <a accesskey="1" href="htmlindex.php">Full ApGap</a>
<br/>
2 <a accesskey="2" href="#Applications">Applications</a>
<br/>
3 Games
<br/>
4 <a accesskey="4" href="#Ringtones">Ring Tones</a>
<br/>
5 <a accesskey="5" href="#Pictures">Pictures</a>
<br/>
6 <a accesskey="6" href="messaging.php?s=wml">Messaging</a>
<br/>
7 <a accesskey="7" href="gcd.php">Custom GCD's</a>
</p>
</card>
<card id="Applications" title="ApGap Applications">
<p>
Download Applications
</p>
<p>
1 <a accesskey="1"
href="applications/SendNote.jad?r=020002">SendNote</a>
<br/>
2 <a accesskey="2"
href="applications/minisendnotejad.php?z=1">MiniSendNote</a>
<br/>
0 <a accesskey="0" href="#HOME">Back</a>
</p>
</card>
<card id="Ringtones" title="ApGap Ring Tones">
<p>
Ring Tones
</p>
<p>
1 <a accesskey="1"
href="ringtones/AddamsFamily.gcd">Addams Family</a>
<br/>
2 <a accesskey="2" href="ringtones/ALFTheme.gcd">ALF Theme</a>
<br/>
0 <a accesskey="0" href="#HOME">Back</a>
</p>
</card>
<card id="Pictures" title="ApGap Pictures">
<p>
Pictures
</p>
<p>
1 <a accesskey="1" href="pictures/Angela.gcd">Angela</a>
<br/>
2 <a accesskey="2" href="pictures/William.gcd">William</a>
<br/>
3 <a accesskey="3" href="pictures/Rich.gcd">Rich</a>
<br/>
4 <a accesskey="4" href="pictures/flowers.gcd">Flowers</a>
<br/>
5 <a accesskey="5" href="pictures/peacock.gcd">Peacock</a>
<br/>
0 <a accesskey="0" href="#HOME">Back</a>
</p>
</card>
</wml>Welcome to the Mobile Application Gap.
Links:
1 Full ApGap
2 Applications
3 Games
4 Ring Tones
5 Pictures
6 Messaging
You can see this site is solely designed to deliver downloadable content to Sprint phones. I try to make the pages small and to the point. If you want to read all about what you are downloading then you have to visit the full HTML version of ApGap. I'm not trying to deliver articles or any kind of long text. I just want something easy to navigate so people can find the item they want to download and get on with it.
The first card is basically an index to the other cards. I also provide a link to the HTML version of ApGap just in case you are brave enough to try viewing it from your cell phone. Realistically, I provide this link for PDAs and smartphones that have fast(ish) processors and large(ish) displays.
I've divided my content into applications, games, ring tones, and pictures. Currently I don't have any games available, but I might some day so the category is just a placeholder for now.
The last item isn't content for downloading. Rather, it's a simple form for sending Sprint text messages from your cell phone. Sprint has a form at http://messagings.sprintpcs.com but you will find that page is practically unusable from a cell phone. I made a simpler version of it for my WML site, but that's a topic for another article.
Links:
1 Full ApGap
2 Applications
3 Games
4 Ring Tones
5 Pictures
6 Messaging
Accesskey
If you already know WML, then you may be wondering what the "accesskey" attribute is on the anchor tags. While I am the first to standup and argue for adhering to standards, the accesskey attribute is an indulgence that can't be passed up. On most Sprint phones, this will create single keystroke shortcuts to hyperlinks. That means visitors can simply press "4" on their keypads to jump to the ring tone download page. While it's not a standard WML attribute, it sure makes a WML page easier to use. Alternatively, you'd have to scroll down to the link you want and select it. You'll find that every keystroke you save is important. Mobile keypads are hard to use and the more you can avoid it, the better.Cards
Ranking right up there with things to be avoided is network access. You'd like to design your site to minimize the number of times the mobile device has to query the network. In fact, you'll find that devices feel slow because of the number of network transactions, not because of the speed of the network. Sprint offers a very fast 3G network. I can download a good size MIDlet in just a few seconds, but slogging through multiple pages in the browser is painful. Every time you select a link, the device has a pleasant conversation with the server over tea and biscuits before you actually get to see what you want. I don't really know what they are discussing so thoroughly but it just seems to take forever. I suppose it's like watching a pot boil. You are left standing there staring at the little arrows go back and forth. Thrilling. It's one of the reasons Short Mail is so hated. Every message you receive requires three interactions with the network to read. You waste more time waiting for each client/server pleasantry then it would take to just download the stupid 100 character message in one shot. Sorry, back to the subject. I avoid these little network interactions by downloading several cards at once when the user requests the ApGap home page. If your mobile site has several pages to it, try putting them all together in a single deck, then look at how long it takes to retrieve the entire deck vs. downloading a smaller version that points to multiple files. I think you'll find the overhead of simply loading everything in one shot is worth it for the responsiveness that you gain. When you select "Ring Tones" from ApGap, you are immediately taken to a directory of GCD links for ring tones. That list was loaded along with the front page so the transition happens quickly, without network interaction.GCD?
This is where things get sticky for most people. To download ring tones and pictures to Sprint phones, you need to have a General Content Descriptor for each file. Likewise, to send Java programs, you need a Java Application Descriptor. If you don't know what goes into a JAD, there's another article that covers that topic. What I'd like to point out here is that sending GCD files and JAD files requires that your sever have the proper MIME type defined for those files. Ah, this is where we started! Yes, it comes back to MIME types. Most servers are already configured to support the popular MIME types. Unfortunately, GCD, JAD, and JAR files aren't considered popular MIME types. Dollars to doughnuts, your server won't handle them properly. You can't just make a web page on your AOL account and server up cell phone content. In fact, it's difficult to find a hosting company that (1) will allow you to define MIME types or (2) has the proper types already defined.Caching
One final gotcha you will face is Sprint's aggressive caching policies. When you request a page or a file from a server it may not come from the server. It may instead come from Sprint's local cache of the file. You see, WAP browsing works through a proxy. When you request a page from ApGap, your phone sends the request to Sprint and Sprint acts as a proxy for your phone. Sprint goes to ApGap, retrieves the file and passes it on to you. In an effort to optimize, Sprint may not go to ApGap every time. Instead, Sprint will keep a local copy of pages that are requested frequently. Many times Sprint will just send that cached copy to your phone rather than requesting a fresh copy from the server. While this is a great way to save bandwidth for Sprint, it causes real problems for developers. While you are testing out some new code, you might upload several copies to your website so that you can then download them to your phone. Unless each copy has a unique name, Sprint will step in, cache the first version of your program and for there after and ever more, that will be the only version you will be able to download. Obviously this is not good. To get around the issue, I add some junk on to the end of my URLs that fool Sprint into thinking that I am requesting new content every time. That's why you'll notice the link to my SendNote application looks like "applications/SendNote.jad?r=020002". This means the program is in the "applications" sub-directory and the revision number is "020002". I use revision numbers to help me keep things straight but any junk will do. I could have easily used "?junkblahgarbage" at the end of the URL. As long as it's unique then I'm sure I'm getting the latest copy from my server instead of a stale copy from Sprint's cache. Remember, your GCD and JAD files also contain links to your actual content like your JPG or JAR file. You will also need to update the links in your descriptors every time as well. If you look inside my JAD file for SendNote, you'll find "http://www.apgap.com/applications/SendNote.jar?r=020002" for the JAR file. The need for this type of URL monkey business is one of the most annoying parts of trying to develop Sprint applications. I have written some scripts that automatically generate the corrected URLs by adding random numbers or using the version number from the JAD file.Cut to the Chaff
I use Digital Sense Hosting for most of my websites and I highly recommend them. They are cheap and they give you lots of control over the server. I have Linux accounts using Apache servers. That means I can create all the MIME types I need by adding lines like the following to my ".htaccess" file.AddType text/x-pcs-gcd .gcd
AddType text/vnd.sun.j2me.app-descriptor .jad
AddType application/java-archive .jar
AddType text/x-hdml .hdml
AddType text/vnd.wap.wml .wml
AddType text/vnd.wap.wmlscript .wmls
AddType image/vnd.wap.wbmp .wbmp
AddType audio/x-midi .mid
AddType audio/vnd.qcelp .qcp
AddType image/png .png
That's overkill really. Most of those are already properly defined in the httpd.conf file. Really, the only ones I need are jar, jad, gcd, and qcp.
AddType text/vnd.sun.j2me.app-descriptor .jad
AddType application/java-archive .jar
AddType text/x-hdml .hdml
AddType text/vnd.wap.wml .wml
AddType text/vnd.wap.wmlscript .wmls
AddType image/vnd.wap.wbmp .wbmp
AddType audio/x-midi .mid
AddType audio/vnd.qcelp .qcp
AddType image/png .png