Re: How to write a daemon/background app?
Re: How to write a daemon/background app?
- Subject: Re: How to write a daemon/background app?
- From: James Chen <email@hidden>
- Date: Tue, 16 Dec 2003 19:40:59 +0800
Thanks, Stephane
That resolves my problem.
In that case, you can write a Background Cocoa app which when it's
launched for the first time (or when it's installed) decalres itself
to be a Login Item (I think there's some code available somewhere
explaining how to do this).
I have no clue to find such stuff.
Could you point me to the place you mentioned?
Very appreciate,
Jam
On Dec 16, 2003, at 7:28 PM, Stephane Sudre wrote:
In that case, you can write a Background Cocoa app which when it's
launched for the first time (or when it's installed) decalres itself
to be a Login Item (I think there's some code available somewhere
explaining how to do this).
Then you also need to state that the application is a background app
by adding the following key in the Info.plist
NSUIElement "string" 1
In PB, you add it in the Target Info.plist entries expert view.
In XCode, I don't know as I'm not using it.
On Tuesday, December 16, 2003, at 12:06 PM, James Chen wrote:
I think it runs only when the user logged in?
Actually, I'd like to write a program which will inform me it's time
to take a break. So that I won't work too hard to forget to relax.
(something like "screen saver", I'd like to call it "Energy" Saver
maybe)
Jam
On Dec 16, 2003, at 6:42 PM, Stephane Sudre wrote:
Does this background app need to run forever or just when a user is
login?
On Tuesday, December 16, 2003, at 11:30 AM, James Chen wrote:
Hi,
I'd like to write a simple alarm app which runs in the background.
And then prompts a Alert Dialog when the time is out.
The issue is, I usually wrote a "normal" application, I don't know
how to write a daemon.
So I start with the Cocoa Application Project Template from XCode.
(I will use Cocoa in this daemon)
And try some codes from Apple like this:
int main()
{
daemon(0,0);
while(1) {
syslog(1, "test");
sleep(5);
}
}
Yes, the program works but I can see my application's icon appears
on Dock and vanish.
Although it happens in less a second, that isn't what I want it to
be.
Could someone teach/help me to figure it out or point me some
useful references?
Appreciate for any comment and help,
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.