About modes

You can select one out of 4 modes to change the data format receiving from the Ring device.
The 4 modes are like following:

Avoiding Selecting Unexpected Mode

The mode of the Ring can be changed in some situations unexpectedly.
To prevent your app from unwanted behavior, there are some tricks listed below.

Default Settings

The gesture mode is selected by default. This means it will be selected when the Ring device is disconnected, buttery dies, restore from sleep, and so on.
You can force changing to other mode in the deviceDidInitialize method in your CRApplicationDelegate implementation when these event happens.

Long Tap

When a long tap event is detected on the touch sensor of the Ring device, the mode will be changed to the gesture mode.
You can catch the long tap event as CRRingEventLongPress in the deviceDidReceiveEvent method in the CRApplicationDelegate implementation.
(See Events and the Event mode for more details).

Changed by another app

Another app using Ring iOS SDK can change the mode of the Ring device.
Then you should change it to your desired mode in the applicationDidBecomeActive method in UIApplicationDelegate implementation.

Changing the Mode of the Ring Device

To change the Mode of the Ring Device, you can use the setRingMode method defined in the CRApplication class.
Modes can be selected are defined as the CRRingMode enumeration in CRCommon.h.

CRRingMode

setRingMode

Implementation Example

An example which changes the mode of the Ring device to the Point in the deviceDidInitialize method.
After that, it logs the X-Y coordinates when a movement of the Ring device is received in the didReceivePoint method.

Swift

import UIKit

class ViewController: UIViewController, CRApplicationDelegate {

  var ringApp: CRApplication!

  override func viewDidLoad() {
    super.viewDidLoad()

    ringApp = CRApplication(delegate:self, background: false)
    ringApp.start()
  }

  func didReceiveEvent(event: CRRingEvent) {
    if event == .LongPress {
      ringApp.setRingMode(.Point)
    }
  }

  func didReceivePoint(point: CGPoint) {
    print(point)
  }

  func didReceiveQuaternion(quaternion: CRQuaternion) {
  }

  func didReceiveGesture(identifier: String!) {
  }

  func deviceDidInitialize() {
    ringApp.setRingMode(.Point)
  }

  func deviceDidDisconnect() {
  }
}

Objective-C

#import "ViewController.h"
#import <CoreRing/CoreRing.h>

@interface ViewController () <CRApplicationDelegate>
@property (nonatomic, strong) CRApplication *ringApp;
@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  self.ringApp = [[CRApplication alloc] initWithDelegate:self background:NO];
  [self.ringApp start];
}

- (void)didReceiveEvent:(CRRingEvent)event {
  if (event == CRRingEventLongPress) {
    [self.ringApp setRingMode:CRRingModePoint];
  }
}

- (void)didReceivePoint:(CGPoint)point {
  NSLog(@"%@", NSStringFromCGPoint(point));
}

- (void)didReceiveQuaternion:(CRQuaternion)quaternion {
}

- (void)didReceiveGesture:(NSString *)identifier {
}

- (void)deviceDidInitialize {
  [self.ringApp setRingMode:CRRingModePoint];
}

- (void)deviceDidDisconnect {
}

@end


<Configure the Application     |     TOP     |     Events and the Event mode>