How to enable/disable Bluetooth with a Xamarin widget
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
util
.gitignore
LICENSE
README.md

README.md

xamarin-bluetooth-toggle-widget

This is a simple tutorial/how-to on building a widget for an Android device, using Xamarin.

bluetooth logo bluetooth logo bluetooth logo bluetooth logo

I've used an example of enabling/disabling Bluetooth because

  • It's slightly more complex than a pointless "hello world!" widget that doesn't actually show you anything.
  • I needed a widget to do this, so I built one. Yes, I could have just downloaded one, but where's the fun in that? And this way you may benefit too.
  • It's reproducible enough that it can be used to build a similar one for wi-fi, or location, or NFC or something else.

As it stands, this widget does the following:

  • Reacts and changes its display based on power-state and connectivity-state changes in your device's built-in adapter.
  • Toggles the enabling/disabling of the default Bluetooth adapter by tapping the widget.

It is based on the (simpler) xamarin-bluetooth-status-widget, which I built a couple of weeks ago, and promised to extend to allow toggling and monitoring of connectivity status too. And to show you how it all fits together, there's a post on my blog over at wislon.io

I've also released it as an app on the Google Play store, because reasons.

####License Copyright (c) 2014, John Wilson.

This code is released under the MIT license. However one of the Bluetooth symbol images is provided by a third-party, and was distributed as 'freeware, not for commercial use'. So if you plan on using the code in this repo as the basis for a commercial product (go right ahead!), you'll need to source your Bluetooth symbol image(s) from elsewhere