Hello guys,
I’ve been trying to get the beacons i recently received to get to work. But i haven’t succeeded yet. Ok so here is the steps i have made and done, maybe i’m forgetting something or doing something wrong but i really would like to get it to work.
Ok so i have downloaded the Estimote app and i can see the 3 “location beacons” and i can edit the settings of them. This way i know my bleutooth isn’t off or that my phone (google nexus 5x) isn’t compatible.
here is my code:
public class MainActivity : Activity, BeaconManager.IServiceReadyCallback
{
BeaconManager beaconManager;
string scanId;
bool isScanning;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
if (!checkPermission (Manifest.Permission.AccessCoarseLocation)) {
requestPermission (Manifest.Permission.AccessCoarseLocation, PERMISSION_ACCESS_COARSE_LOCATION);
} else {
Console.WriteLine ("Already got permission start beaconmanager");
if (!SystemRequirementsChecker.CheckWithDefaultDialogs (this)) {
Console.WriteLine ("We Can't check!");
} else {
Console.WriteLine ("We are gonna check now!");
enableBeaconManager ();
}
}
}
public void enableBeaconManager () {
beaconManager = new BeaconManager (this);
// Wearables will be triggered when nearables are found
beaconManager.Nearable += (sender, e) => {
Console.WriteLine (string.Format ("[{1}] Found {0} nearables.", e.Nearables.Count, DateTime.Now));
};
beaconManager.Connect (this);
}
protected override void OnStop ()
{
base.OnStop ();
if (!isScanning)
return;
isScanning = false;
beaconManager.StopNearableDiscovery (scanId);
}
public void OnServiceReady ()
{
isScanning = true;
scanId = beaconManager.StartNearableDiscovery ();
}
protected override void OnDestroy ()
{
base.OnDestroy ();
beaconManager.Disconnect ();
}
In the console it says (every second) it has found 0 nearebles so what am i doing wrong here? Or how can i fix it? The permission i have given myself is the AccessCourseLocation.
Thanks in advance!