Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
More documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Mar 22, 2013
1 parent dd45d50 commit a429f12
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,35 +225,17 @@ Crash reports are normally sent to our server asynchronously. If your applicatio

3. Initialize usage tracking depending on your needs.

a. One example is to track usage when a document is opened

- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError {
[[BITSystemProfile sharedSystemProfile] startUsage];
}
and stop tracking usage when a document is being closed.

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError {
[[BITSystemProfile sharedSystemProfile] stopUsage];
}
The SDK takes care if multiple documents are used. But this code doesn't consider when the app goes into background and will continue counting the time!

b. Another example scenario is when the app is started or comes to foreground and when it goes to background or is terminated:

- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
BITSystemProfile *bsp = [BITSystemProfile sharedSystemProfile];
[dnc addObserver:bsp selector:@selector(startUsage) name:NSApplicationDidBecomeActiveNotification object:nil];
[dnc addObserver:bsp selector:@selector(stopUsage) name:NSApplicationWillTerminateNotification object:nil];
[dnc addObserver:bsp selector:@selector(stopUsage) name:NSApplicationWillResignActiveNotification object:nil];
};
On example scenario is when the app is started or comes to foreground and when it goes to background or is terminated:

- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
BITSystemProfile *bsp = [BITSystemProfile sharedSystemProfile];
[dnc addObserver:bsp selector:@selector(startUsage) name:NSApplicationDidBecomeActiveNotification object:nil];
[dnc addObserver:bsp selector:@selector(stopUsage) name:NSApplicationWillTerminateNotification object:nil];
[dnc addObserver:bsp selector:@selector(stopUsage) name:NSApplicationWillResignActiveNotification object:nil];
};

### Show debug log messages

Expand Down

0 comments on commit a429f12

Please sign in to comment.