Hi Experts,
I followed the iOS tutorial to make my application transmit ibeacon, I see the logs as its Advertising. But my Scanner in another device is not scanning the Ibeacon. Can you please let me know why. I am posting the code below.
Also, I have the following enabled in my plist file
1. Location Always Usage Description
2. Location When In Use Usage Description
Please let me know if I have to make any changes to this to make the app transmit ibeacon.
Thanks in advance!
using System;
using Foundation;
using CoreLocation;
using CoreBluetooth;
namespace BeaconAPI.iOS.Transmitter
{
public class BeaconTransmitter : CBPeripheralManagerDelegate
{
private CLBeaconRegion beaconRegion;
private CBPeripheralManager peripheralManager;
public BeaconTransmitter()
{
NSUuid uuid = new NSUuid("8C443036-B927-4965-96DE-83F39C1ABA5A");
this.beaconRegion = new CLBeaconRegion(uuid, 1, 2, "Transmitter");
NSDictionary beaconData = beaconRegion.GetPeripheralData(null);
peripheralManager = new CBPeripheralManager(this, null);
peripheralManager.StartAdvertising(beaconData);
//Console.WriteLine("Started Advertising");
}
public override void StateUpdated(CBPeripheralManager peripheral)
{
if(peripheral.State == CBPeripheralManagerState.PoweredOn){
Console.WriteLine("Advertising");
}else{
Console.WriteLine("Not Advertising");
}
}
public override void AdvertisingStarted(CBPeripheralManager peripheral, NSError error)
{
base.AdvertisingStarted(peripheral, error);
Console.WriteLine("Advertising Started");
}
}
}