Support Home > SDK Integration > SDK – KochavaTracker > Class – KochavaTracker > Instance Method – handleWatchEventsWithWatchIdString:

Instance Method – handleWatchEventsWithWatchIdString:

  • Instance Method

    handleWatchEvents(withWatchIdString:)

    Associates an Apple Watch which has a specific watch identifier with your host.


    Declaration

    Parameters

    watchIdString A watch id string.

    This can be any alphanumeric string value that you want to use as an identifier to associate with the Apple Watch. Note: At the present time there is no identifier associated with an Apple Watch that is provided by the operating system. This parameter is provided for future compatibility and may be used now with your own unique identifier. You may pass a value of nil.

    Overview

    This method should be called once to associate an Apple Watch to your host. There is no harm in calling the method more than once. If you do not care to associate an identifier with the watch then see the convenience method handleWatchEvents().

    Discussion

    As the tracker object exists already in your host application, you will pass data you want to track from the WatchKit Extension to the host application using the openParentApplication method of the class WKInterfaceController. The host application will receive information in your application’s delegate via application:handleWatchKitExtensionRequest:reply:.

    You are responsible for creating a protocol through which you pass information between the WatchKit Extension and the host application, as there might be more information than just what you would track via Kochava. The example below only illustrates how you might choose to pass this information.

    In your application delegate, implement the instance method application(_:handleWatchKitExtensionRequest:reply:) method to parse the data sent to it, so that it knows it should tell Kochava to associate the Apple Watch with your application. You will tell Kochava to associate the Apple Watch with your application by calling the handleWatchEventsWithWatchIdString method of the Kochava tracker object.

     

    Sample Code:

     

    See Also

    Related Symbols func handleWatchEvents()

    Associates an Apple Watch with your host.

    Related Documentation framework Watch Connectivity

    Coordinate activities between your iOS app and your corresponding Watch app.

  • Instance Method

    handleWatchEvents(withWatchIdString:)

    Associates an Apple Watch which has a specific watch identifier with your host.


    Declaration

    Parameters

    watchIdString A watch id string.

    This can be any alphanumeric string value that you want to use as an identifier to associate with the Apple Watch. Note: At the present time there is no identifier associated with an Apple Watch that is provided by the operating system. This parameter is provided for future compatibility and may be used now with your own unique identifier. You may pass a value of nil.

    Overview

    This method should be called once to associate an Apple Watch to your host. There is no harm in calling the method more than once. If you do not care to associate an identifier with the watch then see the convenience method handleWatchEvents.

    Discussion

    As the tracker object exists already in your host application, you will pass data you want to track from the WatchKit Extension to the host application using the openParentApplication method of the class WKInterfaceController. The host application will receive information in your application’s delegate via application:handleWatchKitExtensionRequest:reply:.

    You are responsible for creating a protocol through which you pass information between the WatchKit Extension and the host application, as there might be more information than just what you would track via Kochava. The example below only illustrates how you might choose to pass this information.

     

    In your application delegate, implement the instance method application:handleWatchKitExtensionRequest:reply: to parse the data sent to it, so that it knows it should tell Kochava to associate the Apple Watch with your application. You will tell Kochava to associate the Apple Watch with your application by calling the handleWatchEventsWithWatchIdString method of the Kochava tracker object.

     

    Sample Code:

     

    See Also

    Related Symbols -handleWatchEvents

    Associates an Apple Watch with your host.

    Related Documentation framework Watch Connectivity

    Coordinate activities between your iOS app and your corresponding Watch app.

 
 

Last Modified: Jul 12, 2018 at 8:32 am