Speed from UIAccelerometer - ios5

For my project I need to create an app that displays message based on how vigorously you shake the phone. It should register the maximum speed/g-force in let's say, 3 seconds.
I came up with the example: Let's say that you drop your iPhone from the roof and lands on the pillow and it reaches 1.5G/or 40mph, displays that you reached 1.5G/40mph.
Thanks in advance!

Related

Displaying information over video

I am building an app for iOS (iPhone and iPad) where the user is able to watch video clips of therapeutic exercises. However, I want to overlay some dynamically generated information (the amount of reps and sets assigned to them by their physio) either "over" or next to the video playing. The amount of reps and sets will be like a counter counting down the amount of work they have left before the next exercise will start playing.
Here is a mock-up of what I would like to achieve if possible Video with dynamic information overlay
So while the video is playing the "Hold" will count for a specified number of seconds. When the time limit is reached, "Sets" is increased by 1 and Hold starts from 0 again. When the Sets are all completed, "Reps" increase by 1 and Hold and Reps start back at 0. Etc.
Can the video playing and all this information be displayed simultaneously on the iPhone/iPad?
I have looked at a number of video hosting solutions that might have this feature built into it, but couldnt find anything that would suit my needs.
Is this possible at all as I have never seen anything like this done before?
Could a solution be to use a iFrame to display the video and then have all the other information that I want on the screen separate to this? Just a thought...
Yes, this is possible, have a look at this example project:
http://www.musicalgeometry.com/?p=1273
This is for a camera overlay, but it also works for existing videos.

How to extend the time displaying the launch picture of an iPhone app?

I have added a Default.png picture to my resource folder and the picture is now correctly displayed when the app is launched. But right now I have a problem that the time of the picture shown on screen is just too short and user just doesn't have enough time to take a look at the pic. And idea? Thanks
Make a viewController with an imageView containing the launch image. Then have that viewController load first, and set it to change after some fixed amount of time.
You could load the image onto the screen in the applicationDidFinishLaunching:withOptions method and then trigger a delay (using performSelector:afterDelay) to remove that image after a certain amount of time. That doesn't help you have a consistent load screen time, since the actual load time will vary per device, but it does let you pad the load time a bit.
I suppose if you want to get really fancy, you could pad the load time varying amounts depending on the device. Whatever you do I'd keep it to only an extra second or two.
Maybe you should take a look at Apples description, what the launch image is exactly for. I strongly recommend not to annoy the user with longer than needed "splash screens". Keep in mind, that there are people with devices, which don't support multi tasking. Using your app while getting text messages or other push notifications, switching to another app and back to yours is frustrating big time, if they have to wait until you think, they have payed enough attention to a (mostly) useless image.
Please, think about avoiding the use of nag screens. :)

Response time for a UIButton

I have developed a test for iPod/iPhone (with MonoTouch if that is relevant) that measures reaction time. But I need to take into consideration the time between touching the screen and actual triggering of the button event. Is there any documentation of that?
It's already very hard to almost impossible to get predictable interrupt latency on real time operating systems.
But on the iPhone? Imho impossible. A capacitive touchscreen is not optimal to get results that are exactly the same for each body and location. And if mail.app decides to poll for emails just at the moment you'll touch the screen there will be a bigger delay.
But to make one thing clear, we are speaking about some micro seconds or even less than that.
If you want accurate results you shouldn't use an iPhone. But I guess your app will be some kind of game, so nobody cares if your result is 0.01 seconds off. But I wouldn't show results as 0.381829191 seconds, that fakes accuracy you'll never get on any smartphone.
What is the lowest reaction time you got in your app?
The time between an actual touch and the system registering it will be negligable.
One key thing: if you are detecting the press using touch events like touchUpInside, consider using the touchesDownInside event because touchesUpInside, will not fire until the user's finger leaves the screen.

play a tick sound when one second completes

I am creating an application,in my app i am changing images for countdown. I want to play a Tick sound when one second completes(i mean when image changes).I have a 25 second long sound with repeated tick sound and within time interval of 1 second.
I am new to use sound. can anybody provides me step by step solution for adding sound ?
thanks in advance..
You can take a look at the Metronome example from the Apple site. It makes a ticking sound every second, every half of a second or every quarter of a second, etc.
Download the sample code for the Pragmatic Programmer's iPhone SDK Development book and look for the project labelled "SystemSoundsDemo" (in the MediaPlayback folder). It shows you how to play short sounds in response to events.
If you want more detail, I highly recommend buying the book.

Using iphone accelerometer to count the number of spins when tossed in the air

I would like to have a program that build a program that uses the accelerometer to count the number of time an iphone spins (either on a table top or when tossed in the air ) any suggestions?
The iPhone 4 may be able to do this, as it has gyroscopes that are not affected by acceleration, but when you spin a device with an accelerometer the accelerometer will just report that it seems like there's a large acceleration pointing on a vector from the center of rotation straight out.
You throw your iPhone in the air?
Just a heads up if you're planning on putting this on the App Store - Apple rejected/removed an app that measured the speed an iPhone fell at while being dropped. The reason they gave was because it would encourage users to do things with their iPhone that would potentially damage it. Your app would likely befall the same fate.