Ich habe so viele Links durchsucht, auch nachdem ich keine passende Lösung für den Längen- und Breitengrad gefunden habe.Latitude und Longitude an den Server senden, wenn die App im Hintergrund ist
Periodic iOS background location updates
iOS long-running background timer with "location" background mode
versuchte ich von einigen Links und Foren, aber es ist nur 3 Minuten zu arbeiten, dann ist app nicht alle Benutzer-Standort zu aktualisieren.
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
//create new uiBackgroundTask
__block UIBackgroundTaskIdentifier bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
//and create new timer with async call:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[locationManager startUpdatingLocation];
NSTimer* t = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(startTrackingBg) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] run];
});
}
-(void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
// store data
CLLocation *newLocation = [locations lastObject];
//tell the centralManager that you want to deferred this updatedLocation
if (_isBackgroundMode && !_deferringUpdates)
{
_deferringUpdates = YES;
[locationManager allowDeferredLocationUpdatesUntilTraveled:CLLocationDistanceMax timeout:10];
}
}
@Santo ... überprüfen Sie bitte diese bro..and versucht, mir zu helfen .. http://stackoverflow.com/questions/37338466/sending-current-location-to-server-in-background- as-well-in-running-app-using –
@SurajSukale zuerst lassen Sie mich wissen, bekommen Sie den aktuellen Standort, wenn Sie bauen? – Santo
nein bro ... Eigentlich bin ich sehr neu in dieser App-Entwicklung (1. Mal an diesem speziellen Domain-Standort arbeiten) .... können Sie mir helfen, dies zu lösen –