Ing. Ron
Ing. Ron

Reputation: 2095

Show heart rate from IOS app on WatchKit app continuously

I am wondering what would be best practice to display the heart rate which I get from the BLE heart rate monitor to my IOS app on WatchKit app. A direkt transfer is not possible. I am thinking of a timer which fires every second on the IOS app and transfers the actual heart rate to the SharedDefaults. On the WatchKit app I am also implementing a timer which reads every second from the SharedDefaults. Could that be a good solution?

// Create and share access to an NSUserDefaults object. NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.example.domain.MyShareExtension"];

// Use the shared user defaults object to update the user's account. [mySharedDefaults setObject:bpm forKey:@"heartrate"];

Upvotes: 0

Views: 450

Answers (1)

Stephen Johnson
Stephen Johnson

Reputation: 5121

You can also pass data from your iPhone app to your WatchKit extension using https://github.com/mutualmobile/MMWormhole and then you don't need to rely on an always running timer.

Upvotes: 1

Related Questions