Join Steven Lipton for an in-depth discussion in this video Prevent user actions, part of Advanced iOS App Development: Core Motion.
- [Narrator] In the last section, I mentioned again…that it was on in my car.…This game actually prevents me from playing it…while I'm in my car.…And, that's why it's monitoring stuff.…This is a common use of the motion activity.…So, let's do something similar.…I'll add some code to prevent us from running…around with a sword in the fencing app.…Go ahead and stop the pedometer app.…Go ahead and close up the pedometer.…If you don't have it open,…open the fencing app.…If you have the console open,…go ahead and close that, too.…
Go to near the top of the code,…and we're going to add a property.…And it will be: let motionActivityManager…= CMMotionActivityManager.…I'm also going to set a flag here.…And that's going to be a var isSafe = true.…I'll set a flag as a property to determine…if gameplay is safe.…
After that, I'll add a new func startSafetyCheck.…Check the activity manager is available.…And, this time I'm not going to say anything…about if it's not.…So, I'm going to write into the activity updates:…motionActivityManager…
- Reading Core Motion data
- Understanding Core Motion methods
- Creating a pedometer app
- Using pace and distance data from Core Motion
- Pushing and pulling device motion data
- Accessing the altitude sensors
- Working with the motion activity manager (CMMotionActivityManager)
Skill Level Advanced
iOS App Development: Accessibilitywith Kevin Favro2h 34m Intermediate
Advanced iOS Development: Working with APIswith Saul Mora1h 59m Intermediate
1. Core Motion Introduction
3. Device Motion
5. Recorded Data
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.