-
-
Save ztirom/e3498287cf6369e66535676a72dc77cb to your computer and use it in GitHub Desktop.
First steps with Xamarin and the Microsoft Band SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Activity(Label = "Hello World Band Android", MainLauncher = true, Icon = "@drawable/icon")] | |
public class MainActivity : Activity { | |
protected override void OnCreate(Bundle bundle) { | |
base.OnCreate(bundle); | |
SetContentView(Resource.Layout.Main); | |
Button button = FindViewById<button>(Resource.Id.MyButton); | |
SetupBand(); | |
button.Click += delegate | |
{ | |
if (myBand != null && myBand.BandClient.IsConnected) | |
button.Text = string.Format("Connected to {0}!", myBand.Name); | |
else | |
Toast.MakeText(this, "Band not yet connected or not found!", ToastLength.Long); | |
}; | |
} | |
private async void SetupBand() { | |
// get instance | |
myBand = Band.Instance; | |
await myBand.PairBand(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment