Error

Notice: Undefined property: stdClass::$forum_tid in forum_node_view() (line 275 of /home/wfrantz/www/sprintdevelopers/modules/forum/forum.module).

Launch MIDlets from a webpage

Submitted by wfrantz on Mon, 09/29/2003 - 15:41

J2ME applications can be launched from a webpage. For example, make a MIDlet called FooBar and install it on a handset. Then, make a web page like this:
[code:1:4e7cd5c7f7]<html>
<a href="midlet:FooBar?data_for_foobar">Launch FooBar</a>
</html>
[/code:1:4e7cd5c7f7]
Open that web page on your handset browser and select the "Launch FooBar" link. Amazingly enough, the Java Application Manager will launch the FooBar MIDlet.

Now within FooBar, put in some code like this:
[code:1:4e7cd5c7f7]import com.sprintpcs.util.*;
...
String uri = null;
Muglet ml = Muglet.getMuglet();
if (ml != null)
{
uri = ml.getURI();
}
[/code:1:4e7cd5c7f7]
You will find that uri contains "midlet:FooBar?data_for_foobar". Strip away the "midlet:FooBar?" part and you can process what ever data was passed from the web page.

If you launch FooBar from the application manager (rather than the web page), you'll find ml is null.

If you do not have a MIDlet called "FooBar" installed, your phone may actually prompt you to download one! My Sanyo 4900 directs me here:
http://vm.sprintpcs.com/redirect?request=midlet%3aFooBar

Of course there is no FooBar MIDlet available at that address, but it's nice of the phone to try.