开机就能自动启动MIDlet
来源:互联网 发布:python 支付宝 编辑:程序博客网 时间:2024/06/06 00:34
开机自启动功能是通过Push注册来完成的,因此可以使用两种方式来注册。第一种通过在jad文件注明PUSH注册的方式即可,如下。
//MIDlet-Push-<n>: <ConnectionURL>, <MIDletClassName>, <AllowedSender>
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 {
//Register so the MIDlet will 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);
}
原文地址:http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_autostarting_jp7midlets.jsp
- 开机就能自动启动MIDlet
- 开机就能自动启动MIDlet J2ME push
- 开机自动启动MIDlet J2ME push
- 开机就自动启动小键盘
- 设定某个服务在开机时就自动启动
- 让你写的c#程序一开机就自动运行 Windows服务实现开机启动
- win7如何添加开机启动程序(开机就自动运行打开)
- win7如何添加开机启动程序(开机就自动运行打开)
- 程序开机自动启动
- 开机自动启动程序
- 开机自动启动程序
- 开机自动启动SVN
- 开机自动启动程序
- Winforms开机自动启动
- 开机自动启动程序
- svn开机自动启动。
- Tomcat开机自动启动
- 系统开机自动启动
- (ZT)十大经典爱情语句
- Pin Connections
- JAVA学习之路:不走弯路,就是捷径
- Visual Studio2005奇怪的bug及解决【月儿原创】
- Intel&AMD故事
- 开机就能自动启动MIDlet
- DotProject中文乱码解决总结
- 上司赏识你的十大秘诀
- 清清月儿 WMI完美秀出CPU编号厂商主频电压等全部信息
- 关于用ADO读取数据库中空字段的发现
- moto手机签名
- 什么是EJB
- 一个PHP文件操作的类
- Experience .NET EnterpriseServices Components