iOS Region Monitoring in Background Mode

后端 未结 3 1455
感情败类
感情败类 2021-02-14 01:09

I am using Region Monitoring in my app and I faced a question that I couldn\'t find any answer to it. How does region monitoring work in background mode?

According to Lo

相关标签:
3条回答
  • 2021-02-14 01:55

    enter image description here

    enable Background Modes in that enable Location updates and Background Fetch

    0 讨论(0)
  • 2021-02-14 01:57

    Region monitoring Relaunches your application when you enter the monitored region if you are in background .

    however you have to again configure your location manager after the app relaunches .

    something like this -

    if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey] ) 
         {
    
            NSLog(@"Relaunched due to location update");
    
            NSLog(@"app woke up times ---- %d",ForTest);
    
            NSLog(@"Starting the location manager");
            self.locmanager = [[CLLocationManager alloc] init];
            [self.locmanager startMonitoringForRegion:(CLRegion)*region];
           // self.locmanager.pausesLocationUpdatesAutomatically = YES ;
        }
    
    0 讨论(0)
  • 2021-02-14 02:03

    As far as I know region monitoring only works with iPhone4 and it's based on the device changing the communication towers. This way it uses way less battery than the standard background location update. Make sure you enabled the appropriate background modes. As long as you implement that delegate, you should be ready to go.

    0 讨论(0)
提交回复
热议问题