title: Run iPhone as an iBeacon in the background
body: <p>Is it possible to run an iOS 7 device as a Bluetooth LE peripheral (iBeacon) and have it advertise in the background?  I have been able to get it to advertise in the foreground with the code below and can see it from another iOS device but as soon as I go back to the home screen it stops advertising.  I did add the bluetooth-peripheral background mode in the plist but that didn't seem to help although I do get the prompt saying the device wants to use bluetooth in the background.  Am I doing something wrong or is this just not possible in iOS 7?</p>
  
  <pre><code>peripManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil];
  
  - (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral
  {
    if (peripheral.state != CBPeripheralManagerStatePoweredOn) {
        return;
    }
  
    NSString *identifier = @"MyBeacon";
    //Construct the region
    CLBeaconRegion *beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:identifier];
  
    //Passing nil will use the device default power
    NSDictionary *payload = [beaconRegion peripheralDataWithMeasuredPower:nil];
  
    //Start advertising
    [peripManager startAdvertising:payload];
  }
  </code></pre>
  
  <p>Here is the code that is on the receiving/listening end:</p>
  
  <pre><code>- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons
             inRegion:(CLBeaconRegion *)region
  {
  //Check if we have moved closer or farther away from the iBeacon…
  if (beacons.count &gt; 0) {
      CLBeacon *beacon = [beacons objectAtIndex:0];
  
      switch (beacon.proximity) {
          case CLProximityImmediate:
              [self log:[NSString stringWithFormat:@"You're Sitting on it! %li", (long)beacon.rssi]];
              break;
          case CLProximityNear:
              [self log:[NSString stringWithFormat:@"Getting Warmer! %li", (long)beacon.rssi]];
              break;
          default:
              [self log:[NSString stringWithFormat:@"It's around here somewhere! %li", (long)beacon.rssi]];
              break;
      }
  }
  }
  </code></pre>