如何在特定时间自动启动 midlet?
我想使用 Push 注册表在指定时间启动 midlet。当我运行应用程序时,即使超过时间,midlet也不会启动。
public void startApp() {
System.out.println( "AlarmMIDlet: startApp" );
try {
Date now = new Date();
long previous;
String cn = this.getClass().getName();
System.out.println("Class name : "+cn);
previous = PushRegistry.registerAlarm( "hello.AlarmMIDlet", now.getTime() + 600 );
System.out.println( "AlarmMIDlet: time of previous alarm: " + previous );
} catch ( java.lang.ClassNotFoundException cnf ) {
System.out.println( "AlarmMIDlet: Class not Found" );
} catch ( javax.microedition.io.ConnectionNotFoundException connnf ) {
System.out.println( "AlarmMIDlet: Connection Not Found" );
}
System.out.println( "AlarmMIDlet: startApp: return" );
notifyDestroyed();
}
有人遇到过类似的问题吗?如何解决这个问题?
I want to use the Push registry to start the midlet at a specified time. When I run the app, even when the time is exceeded the midlet is not started..
public void startApp() {
System.out.println( "AlarmMIDlet: startApp" );
try {
Date now = new Date();
long previous;
String cn = this.getClass().getName();
System.out.println("Class name : "+cn);
previous = PushRegistry.registerAlarm( "hello.AlarmMIDlet", now.getTime() + 600 );
System.out.println( "AlarmMIDlet: time of previous alarm: " + previous );
} catch ( java.lang.ClassNotFoundException cnf ) {
System.out.println( "AlarmMIDlet: Class not Found" );
} catch ( javax.microedition.io.ConnectionNotFoundException connnf ) {
System.out.println( "AlarmMIDlet: Connection Not Found" );
}
System.out.println( "AlarmMIDlet: startApp: return" );
notifyDestroyed();
}
Anyone has ever faced a similar problem?How to sort this out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
公平地说,我从未使用过 PushRegistry,但从我读到的内容来看,您需要在 middlet destroyApp() 上安排时间警报。查看这篇文章,向下滚动注册计时器闹钟
To be fair I never used PushRegistry, but from what I read you need to schedule time alarm on the middlet destroyApp(). Have look at this article, scroll down for Registering a Timer Alarm