Friday, April 5, 2013

Writing a .service Bundle

Andy Lee:

When an application service is invoked, the application becomes active. There seems to be no way to avoid this. At best you can immediately hide the application, but there will still be a flicker as windows appear and disappear.

The second way: a .service bundle

If you want a service that is purely a background operation, you can create a standalone service that has no UI. It’s very simple once you know how, but I haven’t found a lot of help online, although some books discuss it and you can find examples on GitHub by searching for NSRegisterServicesProvider.

1 Comment RSS · Twitter

Getting a deletable .service bundle is hard because it's a trade-off between starting the bundle up each time the service is invoked and not being able to delete it if it's always in use. ThisService used to generate services that would stay on indefinitely. ThisService 3 services stay on for two minutes after being invoked and then shut themselves down. It seems like a good compromise but it depends on the specific service.

Leave a Comment