objective c - iphone getting user location at time intervals -



objective c - iphone getting user location at time intervals -

i browsed through of questions in stackoverflow couldn't clear picture. working on iphone application involves getting user's location through gps , processing based on value got. wanted create sure how should implement this? using method :

[locationmanager startupdatinglocation]

gives me accurate location keeps on updating not want. user's location on periodic basis.i.e., every 2 minutes. how implement that?

the method thought (10 sec interval):

- (void)viewdidload { self.locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest; locationmanager.distancefilter = kcldistancefilternone; nstimer *currenttimer = [nstimer scheduledtimerwithtimeinterval:10.0 target:self selector:@selector(theactionmethod) userinfo:nil repeats:yes]; }

and in action method timer :

- (void)theactionmethod { [locationmanager startupdatinglocation]; }

and method didupdatetolocation:

- (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { self.startingpoint = newlocation; nsstring *latitudestring = [[nsstring alloc] initwithformat:@"%g\u00b0", newlocation.coordinate.latitude]; nslog([@"latitude : " stringbyappendingstring:latitudestring]); [latitudestring release]; [locationmanager stopupdatinglocation]; }

now getting value remains same throughout. every 10s location updated values remain same (i tried printing longitude, horizontal accuracy,altitude,vertical accuracy etc.). please help me how exact(atleast accurate because know gps not accurate)user's location every 2 minutes.

and know how implement monitoringregions , significantlocationchange thing. implemented it? couldn't it. did not notice alter (i printed in didenterregion never printed when went , forth in , out of part ). lot in advance.

just same thing you're doing. ignore delegate method , alter theactionmethod: utilize locationmanager.location property want.

iphone objective-c gps core-location cllocationmanager

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -