I have to get accelerometer and location updates and in separate threads but not on the main thread. Also, it should not interrupt one other or other UI tasks.
Location updates and acclerometer updates should be run separately. How to run these two separately?
After getting accelerometer updates I am performing some tasks and after location updates I am performing some other tasks. But I observed that these are interrupting one other.
For location updates I am using delegate method:
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
/// sending location details to server.
}
For accelerometer updates I am using delegate method:
[motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:^(CMAccelerometerData *accelerometerData, NSError *error)
{
if (!error) {
/// Calculating some values and sending those details to server.
}
}];