Automatically start MIDlet on Sony Ericsson JP7 platform

Source: Internet
Author: User
Boot to start automatically midlet has been the dream of J2ME developers, a dream that has been realized on Sony Ericsson's JP7 platform. However, it should be noted that the early models are not supported, such as K790. Please refer to the Sony Ericsson Manual for details.

The power-on self-boot function is done by push registration, so you can register it in two different ways. The first way to sign a push registration in a JAD file is as follows.

Midlet-push-<n>: <connectionurl>, <midletclassname> <AllowedSender>
Midlet-push-1: autostart://:, Autostartstatic, *

Please note that the URL is written autostart://:

If you want to register dynamically, you can use the following method.

//registers the Pushregistry
public void Register () {
//List of registered push connections.
String connections[];
//Check to the If the connection has been registered.
//This is a dynamic connection allocated on the I//time execution the this MIDlet.
Connections = Pushregistry.listconnections (false);
if (connections.length = = 0) {
try {
//register so the MIDlet'll wake up when phone is started.
Pushregistry.registerconnection ("autostart://:", "Autostartdyn", "*");
Sdisplaystring = "MIDlet is registered";
} catch (Exception ex) {
System.out.println ("Exception:" + ex);
sdisplaystring = "Fail:" + ex;
}
Else {
Sdisplaystring = "already registered";
}
Displayform.deleteall ();
Displayform.append (sdisplaystring);
}

Unregisters the Pushregistry
public void Unregister () {
if (Pushregistry.unregisterconnection ("autostart://:")) {
System.out.println ("The Pushregistry is unregistered");
sdisplaystring = "MIDlet is unregistered.";
}else{
System.out.println ("There is no pushregistry to unregister");
sdisplaystring = "No MIDlet to unregister or failed to unregister";
}
Displayform.deleteall ();
Displayform.append (sdisplaystring);
}

Since there is no SonyEricsson JP7 platform on hand, there is no way to test the boot auto start function. If you have the conditions, you can test it yourself.

Original address: http://developer.sonyericsson.com/site/global/techsupport/
tipstrickscode/java/p_autostarting_jp7midlets.jsp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.