ios - how to send background location when application terminated -
ios - how to send background location when application terminated -
i want send location ground in every 10 min when app terminated or in background . please give code , how utilize .. possible if yes suggest me
make sure add together next header:
@interface viewcontroller : uiviewcontroller<cllocationmanagerdelegate>
include framework:
click project in navigator.
click plus button under "link binary libraries"
add corelocation project.
import header file:
#import <corelocation/corelocation.h>
declare cllocationmanager:
cllocationmanager *locationmanager;
viewcontroller.m
- (void)viewdidload { [super viewdidload]; nslog(@"today monday"); mytimer = [nstimer scheduledtimerwithtimeinterval: 60.0 target: self selector: @selector(first:) userinfo: nil repeats: yes]; } -(void)first:(id)sender { locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.distancefilter = kcldistancefilternone; locationmanager.desiredaccuracy = kcllocationaccuracybest; [locationmanager startupdatinglocation]; nslog(@"called"); [self.view setbackgroundcolor:[uicolor greencolor]]; cllocationcoordinate2d coordinate; nsstring * currentlat = [nsstring stringwithformat:@"%f",coordinate.latitude]; nsstring * currentlong = [nsstring stringwithformat:@"%f",coordinate.longitude]; nslog(@"latitude %@",currentlat); nslog(@"longitude %@",currentlong); }
nstimer can called first method ever 1 min
try hope it's help
ios objective-c background cllocationmanager
Comments
Post a Comment