如何在特定时间自动启动 midlet?

发布于 2024-11-02 01:54:25 字数 923 浏览 1 评论 0原文

我想使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

往日情怀 2024-11-09 01:54:25

公平地说,我从未使用过 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文