Flex - Run Air Application In Background

2019-05-14 05:25发布

I am trying to provide my users with the option to have my application launch automatically and complete a task at a certain time every week.

I can make my application launch at log in using NativeApplication.nativeApplication.startAtLogin=true but I then want to detect if the time is the time they selected and if it isn't then run the application in the background until the time does match or the user shuts down their computer.

Does anyone know of a way to do this? On Adobe's webpage comparing Flex web apps and desktop apps it implied to me that applications could be run in the background but I'm struggling to find anything.

2条回答
干净又极端
2楼-- · 2019-05-14 06:02

Either you keep the process running which times when the next 'job' should be ran, or you can set a system cron job (or something similar) which is specific to the OS. You'll want to use the NativeWindow option of 'LIGHTWEIGHT' so that your application doesn't show up to the user.

Personally, for these kinds of processes, I don't even try to use Air since it isn't really made for this kind of stuff. It's meant to be used for UI based apps and not process based. Use Java or C# instead.

查看更多
做自己的国王
3楼-- · 2019-05-14 06:12

You can close the initial native window without killing the process

NativeApplication.nativeApplication.autoExit = false;
NativeWindow(this.stage.nativeWindow).close();

OR

You can close the initial native window and create a new window that acts as a desktop widget without appearing in the taskbar with either the UTILITY or LIGHTWEIGHT window type.

http://help.adobe.com/en_US/air/reference/html/flash/display/NativeWindowInitOptions.html#type

查看更多
登录 后发表回答