0
Reply

"if from 1 to 2 to 3 to 4 happened, then..." how to write?

pie bos

pie bos

Nov 9 2015 5:44 AM
348

Hello all,

I'm quite new to Xamarin as well as C#. By using the Ibeacon APK FindTheMonkey, I am now trying to create my own Bluetooth beacon app as a learning project. There is a lot of documentation available about this subject. For example, it is important to know that a beacon has 3 ranges and therefor you cannot calculate how far exactly a device is,.

What I would like to do is show some kind of message, when an app user leaves behind his beacon. It will be like a keyfinder. The problem is that I do not know how I can write something like "if a user’s position goes from the state immediate to near to far, then a message shows up.".

I am not asking how to show a message, since I’m pretty sure I will be easy to find more about that in guides.

Sorry if my English isn't perfect. Can anyone help or show me where to look?

Thanks!

This is part of the FindTheMonkey/my App to give you an idea:

void RangingBeaconsInRegion(object sender, RangeEventArgs e)
{
if (e.Beacons.Count > 0)
{
var beacon = e.Beacons.FirstOrDefault();

 switch((ProximityType)beacon.Proximity) { case ProximityType.Immediate: UpdateDisplay("You found the beacon! " + "(" + minor + ")", Color.Red); break; case ProximityType.Near: UpdateDisplay("You're getting close", Color.DarkOrange); break; case ProximityType.Far: UpdateDisplay("What planet are you on? (far)", Color.Orange); break; case ProximityType.Unknown: UpdateDisplay("I don't know how close you are now..", Color.Yellow); break; }             previousProximity = beacon.Proximity; }