tags:

views:

68

answers:

3

for my application i want to calculate my car/bike speed using iphone who can i do that , and it should run continuously run in background ....

please help me

A: 

the only way i can think of is thru GPS. the accelerometer is out. but im not sure if enough information is provided thru "GPS API".

AlvinfromDiaspar
If it provides position, "just" calculate its change within an interval, and there's your speed (accuracy issues aside).
Piskvor
A: 

Look at the performSelectorInBackground:<#(SEL)aSelector#> withObject:<#(id)arg#>-function.

Then you need to calculate the speed. I suggest you use Google a bit, because that's High School math.

Emil
+1  A: 

CLLocation includes a speed property that will give you the current speed of the device. (Note the comment about the accuracy at that link.)

To get the user's current location, follow the steps in the Location Awareness Programming Guide, under "Getting the User's Current Location".

Finally, to enable location updates in the background, see Receiving Location Events in the Background in the iOS Application Programming Guide.

Robot K
thanks robot , do you have any sample code fro that ?????? if you have it will be very helpfully for me ... :-)
Sukhi
The Location Awareness Programming Guide has sample code. Also, look at the "Related Sample Code" for the CLLocationManager class reference. http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html%23//apple_ref/doc/uid/TP40007125
Robot K