I am writing an iOS app and don't want to start detecting for shake events until after my device has reached a certain speed. I know how to use CMMotionManager to get the CMAccelerationData to detect for shake events but does anyone know what i should use to detect how fast my device is moving? Either CMDeviceMoting/userAcceleration/GPS... i am just cannot find what i should do. I am writing my app in swift but answers in Objective-C will suffice as well.
Thank you for your help
You could use CoreLocation and use a CLLocation's speed property. This requires the device's GPS, and will only work for somewhat large speeds.
Related
I have an idea for a game in iOS but I would need to be able to simulate a wide range of physicsWorld possibilities for the game to work.
I can probably do this manually, but I'm not sure that it would be realistic to do this in real time (I would need to perform the calculations on the fly prior to new game setups). I'm wondering if there's anything built in for iOS.
I am creating an iphone project where I need to make a ball move in the same direction of the shake while the device is being shaken.. and then take a certain speed and path when the shake event ends.
I have searched the net and have only posts that can detect a shake effect after which you will be able to run a preset animation that you want.. and I have found many tutorials where you can make a ball move depending on the tilt of the screen.. however what I would like to do, is make the ball move depending on all criterias: shake rythm, shake speed, and giroscope tilt.. is that possible?
Thanks
To do this accurately you must use Core Motion framework, specifically CMMotionManager class. Depending on the device capabilities this class provides both accelerometer and gyroscope data.
To get the ball moving in correct way, this would require a function that would translate the received data from CMMotionManager into values you can animate. That is hard to guess, so I suggest creating a basic function that detects the force and direction and then tuning the parameters by testing.
I developed an app which calculates distances between current position(lat and long) and another stores location. Current position comes from built-in Gps on iPhone. In some buildings is working indoor( like 8meters far from windows or doors). Why is it working indoor? How can I still get GPS signal without WiFi/3G/4G connection?
i hope someone can answer me
Welcome to SO.
The short answer is, it's out of your control. GPS is not reliable indoors. Sometimes you are able to get a signal, sometimes not. Metal frame buildings are worse than wood-frame buildings, and brick also tends to interfere with GPS signals. Florescent lights also tend to interfere.
In a given indoor setting you'll either get a GPS signal or not.
How to detect the device is falling down or moving upwards in Objective-C or Swift? The Core Motion only detect the movement when we tilt the device I need to detect the free fall of the device. Is there any relevant sensors calculating the falling speed of the iPhone?
Apple iPhone 6 has integrated barometer sensor so this might be the sensor that you are looking for. To access barometer data you will need to use CMAltimeter and CMAltitudeData classes
Ive been working with the iOS sensors a bit off late and i wanted to write an app that would accurately track the motion of the phone in space. I wanted to know if its possible to track the motion of the device and detect gestures, such as drawing a circle with your phone or even moving in a straight line.
I've been searching online about this, and i wanted to know two things:-
1.Is it possible to do this with the CoreMotion framework.
2.If Yes, what is the alternative for older devices that do not support CoreMotion. Without the double integral method using the accelerometer!
This would really help!
Any other alternative ideas are most welcome!
Thanks in advance!
As your write, you cannot do the double integral.
For gesture recognition, I would try dynamic time warping. See my earlier answer here.