0

my app is in background and how can we notice when users opens system camera....

i need to call back when users opens system camera.. or is their any observers to notify code while user opening system camera and taking selfies....

is their any way to track user activity while taking selfies... and when he open back side camera and front camera

is this posible to achieve through notificationCenters or any delegate functions or any handler to handle such type of actions....

Raja Reddy
  • 43
  • 1
  • 12

1 Answers1

1

You cannot listen system camera opens or not but you can listen changes in photos library which means that something happend through camera app. It may be selfie, screenshot and so on...

App should be in background and long running task as well.

You can do this with Photos Framework which is announced iOS8 release.

Read Documentation about change observer https://developer.apple.com/documentation/photos

Apple sample https://developer.apple.com/library/content/samplecode/UsingPhotosFramework/Introduction/Intro.html

Change observing. Use the shared PHPhotoLibrary object to register a change handler for the assets and collections you fetch. Photos tells your app whenever another app or device changes the content or metadata of an asset or the list of assets in a collection. PHChange objects provide information about object state before and after each change with semantics that make it easy to update a collection view or similar interface

You can take photos if any update on photos app, by using photos framework

To register

[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
            if (status == PHAuthorizationStatusAuthorized) {
                [PHPhotoLibrary.sharedPhotoLibrary registerChangeObserver:self];
            }
        }];

To Unregister

[[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];

Relevant delegate

- (void)photoLibraryDidChange:(PHChange *)changeInstance {
}

For more info Link

karthikeyan
  • 3,821
  • 3
  • 22
  • 45