Monitor User App Usage From Mac OS X App - objective-c

I am interested in building a Mac OS X application that requires knowing what applications the user has open and when a new one opens, all when my app is running. It doesn't have to be approved by the Mac App Store (If this violates their use terms). An example of an app that does this is the Rescue Time app.
Thank you for any answers,
Michael Truell

Don't know if you're still trying to needs this, but I did some more research on how to solve this and here is what you could look into:
To get notified when applications are opened by a user, use NSWorkspace's notification center, and add an observer for keys like NSWorkspaceDidActivateApplicationNotification. See the documentation NSWorkspace. You can also use NSWorkspace to get all running applications.
If you need to access information about a running application, you should check out Scripting Bridge, and if you don't care about App Store or sandboxing, check you accessibility api, AX

Related

How to program a sandboxed application in Yosemite

I was trying to program a simple TODO app for Yosemite with sandboxing. Apple has its tutorials for the same but they are not very elaborate. I wanted to know sandbox APIs like sandbox_init() and APIs for console logs (heard sandboxed apps use some special APIs). Could someone please point me to some open source app with sandboxing on Yosemite, so that I could see the APIs that it is using.
You don't need to use sandbox_init() etc. in order to create a sandboxed app.
Roughly, you need to understand:
Use the APIs to find well known directories and don't assume that /Users/username/Documents is the Documents folder, for example.
The app has no access to user files and must gain access via NSOpenPanel.
If the app wants to retain access it has already gained then it needs to create and store bookmark URLs, which can be reloaded during a later invocation.
If the sandboxed app spawns a child process, then that child process needs it's own set of entitlements.
Once you understand that it's normally just a case of setting Use Sandbox in the app capabilities and you're off.

Launch my Mac app in case other Mac app was launched

I need to write Mac app which will start automatically only in case when another particular app was launched. Could you please provide entry point where to look and what to use. Do I need to have special autostart up process? I am new to Mac app development.
You can add observer using CFNotificationCenterGetDistributedCenter() for example.
Please, take a look at this article, here may be the solution Inter-process communication

Can an iBeacon notify a user's iphone without an app being installed?

I'm new to iBeacon's and am trying to understand one simple thing.
Can I use iBeacon to display a notification on a user's iphone without a custom app being installed?
For example, I'd like to build an app that sends out iBeacon messages to people that have an iPhone. When they get near an iPad running my app, it notifies them that they're near my "event", which of course is taking place at the location of my iPad.
Is this possible without the user having already installed another app that I've made to receive notifications of my event?
Note that I'm open to any other tech or ideas that would make this work. I know that Apple does this with their Apple Stores, but I'm guessing they can do this because they already have an app installed on the users device - probably the "AppStore" app.
You typically need an app for any iOS notifications on seeing an iBeacon. That is what Apple does for their stores.
The only exception is if you use Passbook to set up a notification trigger. But you still need the user to install your Passbook entry.

How to detect a docked device in cocoa

I've been searching all over the web and have found solutions to mounted device detection from within a Cocoa App using the NSWorkspace notification system. However this notification doesn't seem to be triggered when an Apple device is docked.
I specifically want my OSX App to detect docked iPads/iPhones, be able asses whether the iOS version of my App is installed and then synchronise files. I realise that the easiest way to do this is using iCloud, but I do not as yet have a developer membership with Apple and would like the option to be able to synchronise files without the internet.
An iTunes like system would be ideal. Any ideas.
Thanks in advance.
Apple don't provide any official APIs for doing what you ask.
Unofficially, you can try the stuff here: https://bitbucket.org/tristero/ipodaccessframework
You can definitely use it to determine whether a particular app is installed (by looking for a match for its bundle-id) and you can read/write files to/fro a particular apps document directory.
Disclaimer: this one is mine. There are definitely other libraries around that achieve similar results.

How to implement a check for update on Mac OS X

I'm trying to create an internal app for my company. I want to provide some kind of "automatic update" feature that give the user a message (with install option) once a new version is available. I know that for windows there is a technology named ClickOnce. Is there some kind of standard implementation for mac os x? Should I write it from scratch? If so, how can I start the install process directly from my application? Should I provide a mpkg?
Sparkle is probably what you want. It's used in many apps and is probably the "norm" of actual automatic update nowadays in mac apps other than the app store itself.