Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is best to manage your connection to Sphero and open/close it in one place. I find it is easiest to do this in the AppDelegate or the RootViewController.</p> <p>For AppDelegate:</p> <ul> <li>Open connection on applicationDidBecomeActive and applicationWillEnterForeground</li> <li>Close connection on applicationWillResignActive and applicationWillTerminate</li> <li>Register for robot state notifications in application didFinishLaunchingWithOptions</li> </ul> <p>If you want to manage the connection in your RootViewController, register for robot notifications on load as well as the same application state notifications mentioned above and do the same connection handling.</p> <p>By connecting in your AppDelegate/RootViewController you can allow your other ViewControllers to not care about handling the connection. You can either have them assume a Sphero is connected if you have logic to notify the user in AppDelegate/RootViewController, or you can share the state.</p> <p>As for the particular use cases you mentioned I would recommend the following: 1. Add the data streaming and response observer on viewDidLoad, you should also enable data streaming here. Remove the observers on viewDidUnload and disable data streaming. 2. Use the multiplayer classes here as you normally would. 3. Add the data streaming and response observer on viewDidLoad, you should also enable data streaming here. Remove the observers on viewDidUnload and disable data streaming. Send joystick roll commands normally.</p> <p>If you would like information about the robot connection state changing you can register/unregister for the connection notifications in each views viewDidLoad/viewDidUnload calls.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload