开机就能自动启动MIDlet一直是J2ME开发者的梦想,这一梦想在索尼爱立信的JP7平台上实现了。不过需要注意的是早期的几款机型不支持,比如K790等。具体请参考索尼爱立信的手册。
开机自启动功能是通过Push注册来完成的,因此可以使用两种方式来注册。第一种通过在jad文件注明PUSH注册的方式即可,如下。
//MIDlet-Push-: , ,
MIDlet-Push-1: autostart://:, AutoStartStatic, *
请注意URL的写法是autostart://:
如果想动态注册,可以通过下面的方法。
//Registers the pushRegistry
public void Register(){
// List of registered push connections.
String connections[];
// Check to see if the connection has been registered.
// This is a dynamic connection allocated on first
// time execution of this MIDlet.
connections = PushRegistry.listConnections(false);
if (connections.length == 0) {
try {
//Re
开机就能自动启动MIDlet J2ME push
最新推荐文章于 2025-04-28 16:23:30 发布