黑莓如何安排应用程序

发布于 2024-12-18 16:12:28 字数 183 浏览 1 评论 0原文

在黑莓中,我需要能够在一天中的特定时间启动和关闭应用程序。假设从上午 8:00 开始,然后在下午 5:00 关闭应用程序。是否可以在黑莓中以这种方式安排应用程序?

我正在寻找的功能类似于 Unix 或 Windows 调度程序中的 cron。 我不是开发人员。是否有一个应用程序提供类似于 cron 或 windows 调度程序的功能?

In the blackberry, I need the ability to start and close applications at certain times of the day. Say start at 8:00am and then close the app at 5:00pm. Is it possible to schedule applications this way in blackberry?

The functionality I am looking for would be similar to say cron in Unix or Windows scheduler.
I am not a developer. Is there an app which provides functionality similar to cron or windows scheduler? 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

不弃不离 2024-12-25 16:12:28

您可以使用 ApplicationManager 的功能来安排应用程序启动:

ApplicationDescriptor descriptor = ApplicationDescriptor.getCurrentApplicationDescriptor();
ApplicationManager manager = ApplicationManager.getApplicationManager();

// Compute the time when it need to be scheduled
long toberuntime;
manager.scheduleApplication(descriptor ,toberuntime,true);

还要记下日期和时区更改,如所述

You can use ApplicationManager's functionality to schedule the application launch:

ApplicationDescriptor descriptor = ApplicationDescriptor.getCurrentApplicationDescriptor();
ApplicationManager manager = ApplicationManager.getApplicationManager();

// Compute the time when it need to be scheduled
long toberuntime;
manager.scheduleApplication(descriptor ,toberuntime,true);

Also make note of date and timezone changes, as mentioned here

撩发小公举 2024-12-25 16:12:28

这是每分钟调用一个可运行程序的另一个示例。

请注意,您必须为该任务设置备用条目,并确保它在设备启动时启动。应用程序管理器负责调度作业。

在此示例中,每次调用后台 aep 时设备都会振动。

 public static void main(String[] args)
 {
    // Create a new instance of the application and make the currently
    // running thread the application's event dispatch thread.
    if(args != null && args.length > 0 && "ticker".equals(args[0])){
        scheduleUpdate();

    }else{
        UIapp theApp = new UIapp ();       
        theApp.enterEventDispatcher();
    }
 }

private static void scheduleUpdate() {
    // TODO Auto-generated method stub
    Alert.startVibrate(2550);

    ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();

    current.setPowerOnBehavior(ApplicationDescriptor.DO_NOT_POWER_ON);

    ApplicationManager manager = ApplicationManager.getApplicationManager();

    //check if device has booted and is ready..
    if(!manager.inStartup()){
        try{
            TickerUpdateService tickerUpdater = new TickerUpdateService(endpointURL);
            tickerUpdater.start();
        }catch(Exception Ex){
            System.out.println(Ex.getMessage());
        }
    }

    manager.scheduleApplication(current, System.currentTimeMillis() + 60000, true);
}

This is another example where a runnable is called to every minute.

Please note that you have to setup an alternate entry for the task and make sure it starts when the device starts. Application Manager is responsible for scheduling the job.

in this example, the device vibrates every time the background aep is called.

 public static void main(String[] args)
 {
    // Create a new instance of the application and make the currently
    // running thread the application's event dispatch thread.
    if(args != null && args.length > 0 && "ticker".equals(args[0])){
        scheduleUpdate();

    }else{
        UIapp theApp = new UIapp ();       
        theApp.enterEventDispatcher();
    }
 }

private static void scheduleUpdate() {
    // TODO Auto-generated method stub
    Alert.startVibrate(2550);

    ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();

    current.setPowerOnBehavior(ApplicationDescriptor.DO_NOT_POWER_ON);

    ApplicationManager manager = ApplicationManager.getApplicationManager();

    //check if device has booted and is ready..
    if(!manager.inStartup()){
        try{
            TickerUpdateService tickerUpdater = new TickerUpdateService(endpointURL);
            tickerUpdater.start();
        }catch(Exception Ex){
            System.out.println(Ex.getMessage());
        }
    }

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