Subscribe: ConceptDev (Craig Dunn's blog)
Added By: Feedage Forager Feedage Grade B rated
Language: English
app  band  code  data  heart rate  heart  ios  iphone  key  microsoft  new  rate  string  watch  xamarin forms  xamarin 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: ConceptDev (Craig Dunn's blog)

ConceptDev (Craig Dunn's blog)

Updated: 2018-04-17T09:38:27.097-07:00


Xamarin.Forms Workbooks


As explained in the last post, it's easy to add Nuget packages to Xamarin Workbooks. My immediate reaction to this news was "I want to use Xamarin.Forms!" Unfortunately it's not immediately obvious how to get Xamarin.Forms into a Workbook... so here are the steps (for an iOS Workbook):1. Add the Xamarin.Forms nuget (and reference the platform)When you add the Xamarin.Forms Nuget, four assemblies will be referenced (including the iOS Platform assembly for Xamarin.Forms). The using statements need to be added too - don't forget to add the Xamarin.Forms.Platform.iOS namespace:2. Create a Page and App as usualIn both classes it's a good idea to create public properties for elements you want to manipulate in the workbook.This allows those controls to be referenced later in the workbook...3. Hack the FormsAppDelegateThe biggest hurdle to getting Xamarin.Forms to run is that in a normal iOS app, the AppDelegate must be a subclass of FormsApplicationDelegate to wire up various bits of Xamarin.Forms. Peeking into the open-source, the key thing we need to do is set the RootViewController... the following code does the initialization we need to get a Workbook running:WARNING: obviously this approach misses some of the other code implemented in FormsApplicationDelegate so some things might not work as expected. This is a bit of a hack :)4. Run ItThe public properties on the App and Page classes mean the workbook can manipulate those elements to demonstrate various Xamarin.Forms capabilities.Try it out with the WorkbookFormsTest workbook:Check out the more complex ListView1 workbook too:p.s. the irony of included screenshots of code is not lost on me - but hey, it's actually a good reason to download and us Xamarin Workbooks to try these samples out :D[...]

Xamarin Workbooks with Nugets


Xamarin Workbooks are getting better and better (check out the intro to Workbooks if you don't know what I'm talking about).

Nuget packages can now be added, meaning you can teach or demo almost anything in a Workbook :)

In the Workbook app, choose File > Add Package... to open the Nuget package explorer:

Then search for the Nuget and add to the workbook:

Try out this Json.NET Workbook example to see how it works

Coming up next - adding the Xamarin.Forms nuget!

p.s. for a video demo of Nugets in Workbooks, check out this community contribution on

Xamarin Evolve 5k


Update: thanks everyone who ran!

There's been a tradition for the more energetic attendees to do a morning 5k run during Xamarin Evolve - and 2016 will be no different! Xamarins have been out training most mornings, and we look forward to meeting and running with our customers. It's a FUN run, not a race - if you've got your gear and can complete the distance, please join us! Follow @conceptdev for twitter updates.

Date: Wednesday 27th (first day of conference, before the keynote)
Time: 6:15am
Place: outside Hyatt reception (near the flagpoles)

The Course

We'll run a flat 5km (3.2 mile) loop anti-clockwise around the conference center and surrounds:

It'll be early morning so traffic should be light (based on the past few days), however there are a couple of road crossings and safety will be the priority over speed. This is what the meeting place looks like at 6:15am:

For the speedsters, hang around at the end if possible to celebrate with everyone, get a group photo, and ensure you get mini-hack credit for completing the run!

Introducing Xamarin Workbooks


The first public demonstration of Xamarin's new Workbooks idea was Miguel de Icaza's //build 2016 talk "Mobile First" (although he first wrote about it back in February). In his talk, Miguel demonstrates a new take on interactive documentation in which a Markdown-formatted file can live-execute C# code-fenced blocks; not just in-line but also in an iOS or Android simulator.

This opens up a great opportunity to write and share interactive documentation that not only describes an API or feature, but shows it in action. Further, it's easy to write, being based on the well-known Markdown format.

Give it a try!

You can now try Workbooks for yourself! The editor can be downloaded here, and there is some Workbook documentation on the Xamarin developer portal.

I've thrown together a few very simple ideas on github:

See Miguel's talk (if you didn't already) for a really cool demo.

Some Notes

  1. They're written in Markdown, but with a .workbook file extension.
  2. Each file begins with a small JSON-formatted metadata section. The editor will add this for you.
  3. C# code inside triple-backtick code fences will be executed when the file is viewed in the Workbooks editor. 
There's sure to be other resources popping up now that the project preview is publicly available -- Ben Bishop's video is the first community resource I've seen. Can't wait to see what everyone creates with it!

iOS 9-ify your Xamarin.Forms App


It's not just regular Xamarin.iOS apps that can implement fancy iOS 9 features :) Check out the quick hacks I did to this Restaurant Guide Xamarin.Forms sample to add iOS 9 features:

allowfullscreen="" frameborder="0" height="270" src="" width="480">

Mostly using the magic of Dependency Service I added:

No special work was required to get the app running with iPad Multitasking, other than to ensure there was a Storyboard (or XIB) Launchscreen.

Finally, I added the Application Transport Security "opt-out" tags to the Info.plist file, so that the links to all the different restaurants would work in the WebView control.

Download the code from github to try for yourself!

p.s. Ignore the fact that this sample uses Razor templates to generate the restaurant detail view. That is merely a coincidence - this existing Xamarin.Forms sample was the most appropriate to add iOS 9 features to. iOS 9 features can be added to any Xamarin.Forms app, whether it displays data with XAML, C#, or in a Razor HTML template ;)

iOS 9-ify your Xamarin App


With the iPhone 6s models now available, it's possible to build and test all the great new features of iOS 9 with Xamarin. To demonstrate, I've tried to squeeze as many iOS 9 features as possible into one sample: To9o app (that's "Todo" but with a "9" :-) The c# code is on github and screenshots of each iOS 9 feature are shown below.3D Touch3D Touch can used a few different ways, but requires an iPhone 6s to test (the Simulator doesn't support 3D Touch). I started by adding these two:Application ShortcutsPeek and Pop Multitasking for iPadIf the app can resize its UI appropriately, it should work fine for multi-tasking!ContactsUIThe "Todo" app doesn't traditionally need an interface to the Contacts list, but I added it just to give this new API a try :)New Search APIsThe new search APIs let you expose content to search and Siri. I've added both:CoreSpotlightNSUserActivityNotice the Back to Search button in the navigation bar.UIStackViewThis new layout option makes it much easier to build screens that 'scale', and also makes it even easier to support RTL languages (see below).* Note: currently UIStackViews must be drawn using Xamarin's Xcode integration, but the built-in Xamarin iOS Designer will support them soon!Collection View ChangesThe main Todo list is a UICollectionView rather than a table, so it can demonstrate how easy it now is to re-order items with two simple methods added in code. Right-to-Left Language SupportThe entire app can now automatically flip (including UINavigationController animations) when displaying RTL languages like Arabic and Hebrew (note: machine translation used for example, apologies for any inaccuracies).SFSafariViewControllerThis new API makes it easy to implement an in-app web browsing experience with a line or two of code. I've used it just for an "About" window.All these improvements are explained in Xamarin's iOS 9 docs, and the code is available to review. It is still a work-in-progress so check back for more updates. [...]

Microsoft Band SDK + Xamarin


Band-fans were happy to see Microsoft release their Java Android SDK for Microsoft Band a few weeks ago, and their Objective-C iOS SDK this week. Xamarin was then able to almost immediately release the Microsoft Band SDK component for iOS and Android, giving you the same functionality but entirely in C# for all three mobile platforms...I decided to give it a try, converting my "magic eight ball" apps for Xamarin.Forms and Apple Watch to the Band. The idea is: you shake your wrist and the "prediction" appears on the Band!It works because there is an Android app running on the paired phone, using the Band SDK. The app is tracking the Band's accelerometer, and using the readings to decide when you've shaken your wrist a couple of times.When the shake-detection is triggered, the app picks a random number, pushes a new Tile onto the Band (if it doesn't already exist), and then sends a message for the tile with a random "prediction".The Android app is simple, it contains only a Connect button to connect to the Band, and a Vibrate button to test the connection (plus a label that displays the "prediction" text that is sent to the Band).The code for this Android sample is available on github, hopefully I'll get the iOS version running soon.If you want to get more info about developing for the Band, check out Matt's detailed blogpost with code.Finally, Microsoft built a quite detailed Android app that demonstrates all aspects of their SDK, and Matt did an amazing job of porting it to Xamarin - check that out too! [...]

Apple Watch Kit round-up


It's Saturday, a good excuse for a 'fun' post. Here's a little collection of tidbits about the Apple Watch...Apple: Watch Kit - if you're thinking of developing for the platform, might as well start at the source :)Wareable: The best Apple Watch apps... - some great screenshots of apps already being built, including Clear, BMW, and Nike. It's interesting to see the UI design approach being taken by different developers. Check out the similar list on ibtimes.comWatchAware: Watch Apps - great catalog of watch app demos.FastCompany: How the Apple Watch will work... - a couple of thoughts on app design, and screenshots of Todoist.eleks labs' unofficial Tesla app - more design thoughts and prototype video (unofficial development, not affiliated with Tesla)..Daring Fireball: On the Pricing of the Apple Watch - so yeah, "starting at $349" sounds like it's going to be the understatement of the year.WatchKit FAQ - awesome collection of questions and answers (and cute watch drawings too).MartianCraft: Designing for the Apple Watch with Briefs - even if you don't use the tool (which looks great) this is a lovely post on Watch app design.Five Minute Watch Kit - good collection of blog posts.If that's got you interested in building apps for the Apple Watch, it's time to check out Xamarin's Watch Kit Preview and how to get started (inc video) and my first watch app. allowfullscreen="" frameborder="0" height="315" src="" width="560"> I've also got a couple of samples, including Magic 8 Ball, Calculator, Insta, and Todo for you to try.^ watch frame screenshots generated with Bezel thanks to the fine folks at infinitapps.[...]

Apple Watch Kit programming with C# (and Xamarin)


For my "Your First Xamarin.Forms App" talk at Evolve this year I built a very simple version of the classic "Magic Eight Ball" fortune-telling app. Seemed like a perfect example to adapt for my First Apple Watch App. It's built in C# using Xamarin (of course); Xamarin's Watch Kit Preview came out today!Here is the finished app: a simple display that answers any question you ask ;-) Force Touch on the screen to pop-up the menu to ask another question (Shake), or simply say "Thanks". Grab the code from Github. ^ watch frame screenshots generated with Bezel thanks to the fine folks at infinitapps.Apple Watch ProjectsThe solution structure for watch apps consists of three projects (notice that watch apps are split in two parts):an iPhone app which delivers the watch app to the user (and is also obviously a regular iPhone app),an Watch Kit Extension where the code for the watch app runs (on the iPhone, but separate to the iPhone app),a Watch app which is only the storyboard and image resources that go to the watch itself.Storyboard User InterfaceAfter creating the three projects in a new solution, the first step is to draw the user interface in Interface Builder. Right-click on the Interface.storyboard (already in the template) and open in Xcode.I did the following:gave the interface controller a Title: 8Balldragged a Label and centered itCtrl + dragged an outlet from the label into the header file called resultdragged a Menu onto the scene (this is triggered by Force Touch)added and named the two MenuItems: Shake & BackCtrl + dragged an action from the first menu item called shakeRemember: the storyboard (and any image resources) are the the only things that get installed on the watch itself.WatchKit C# CodeWith the user interface defined in the storyboard, I just needed to wire-up the outlet and action I created in C# to make the app work. The C# code will run in the Watch Kit Extension - on the iPhone itself, not on the CPU of the watch.First I copied the Magic Eight Ball responses from my Xamarin.Forms app (it's a simple string array, called options) and then I started to implement methods in the InterfaceController.The Awake method is called when the scene is created, so this is where the code selects its first random response to show the user. I store it in a local variable lastResult and also in NSUserDefaults (for the Glance, explained later). public override void Awake (NSObject context){ base.Awake (context); var rnd = new System.Random(); lastResult = options[rnd.Next(0, options.Length - 1)]; NSUserDefaults.StandardUserDefaults.SetString (lastResult, "lastResult");}Then in WillActivate I set the label's text to the random value: public override void WillActivate (){ result.SetText (lastResult);}Finally, the menu's Shake button should choose a new random response, so the action is implemented to generate new new answer, set the local lastResult variable, the NSUserDefault, and also the label's text. partial void shake () { var rnd = new System.Random(); lastResult = options[rnd.Next(0, options.Length - 1)]; result.SetText (lastResult); NSUserDefaults.StandardUserDefaults.SetString (lastResult, "lastResult");}That's all the code required to get the app running! I did a couple more things, however, to demonstrate how to programmatically modify the Menu... In the Awake method I add another menu item called Thanks: AddMenuItem (WKMenuItemIcon.Accept, "Thanks", new ObjCRuntime.Selector ("tapped"));The Selector is implemented as shown - notice the [Export] is required: [Export("tapped")]void MenuItemTapped () { result.SetText ("You're welcome!");}Glance ModeI also implemented Glance mode, which simply displays the last response generated by the app.The watch app template already includes a GlanceInterfaceController so I just had to drag a couple of Labels onto it, and Ctrl + [...]

Microsoft Band: the end


I had a lot of fun with the Band initially.

Then after literally two seconds in the shower after a long run, it died. I doubt it got that wet - I literally stepped into the shower, noticed the Band was still on my wrist, then took it off and placed it out to dry.

But that was enough to kill it. The screen went all crazy and illegible. It was dead.

I had paid the $20 'extended warranty' fee, so the guys at the Microsoft Store grudgingly replaced it. I say grudgingly because one staff member really didn't seem sure about it; luckily another guy got involved and was more than happy to help me. They made it clear that if I hadn't paid for the extended warranty, they would not be replacing it at all.

Then they asked for another $20. To cover this Band with extended warranty. I was very annoyed by this. I didn't pay. But now I'm too scared to use the Band. What if, while running outdoors, it rains? The Band apparently will die at the slightest hint of water, and next time Microsoft promised they would NOT be replacing it unless I paid the additional $20.

So now I hardly wear it. It's in a drawer somewhere. So long, Microsoft Band, I hardly knew yea...

Microsoft: if you put a GPS in a fitness device, you're saying it's okay to use it outdoors. If that same device fails in the slightest mist of rain, the device itself is a failure.

Microsoft Band (day 7: heart rate)


So far I've had the Band a week, and it's been on my wrist almost every second of that time (except charging). I'm surprised by how easily I got used to wearing it - it is still chunky, but light enough that I can cope :-)The one remaining question people have asked is how good the heart-rate sensor is, so I did a couple of tests today both running and walking/sitting. I used the Band in conjunction with a Polar H7 chest-band paired with both the Polar and Strava apps. I expected the results to be pretty close (given how good the GPS performance is on the Band)... but turns out, not so much. Here's the heart-rate data from the Band - seems consistent with an average of 165 bpm (high of 177). The Polar H7 chest strap data was slightly different though. Here is the graph from the Strava app; it recorded an average of 149 bpm (high 159).And of course you can view the data from the Polar chest-strap in more detail on the Strava website:So there's a bit of variation between what the Band reports and what was recorded on the chest-strap. I did another test just walking for 20 minutes; with the following result:Microsoft Band reported average 107 bpm (high 147)Polar H7 chest-strap reported average 81 bpm (high 93)Only on the internet could two tests be considered a statistically valid sample, but there you go - looks like the Band's heart-rate sensor is not as accurate as a chest-strap ;-) In reality, any number of factors could contribute to the difference: maybe I didn't have the Band on tight enough, maybe face-up versus face-down on my wrist makes a difference, maybe the strap is the bad data, who knows?!The Bottom LineThat's all the blog posts for now - my first week with the Microsoft Band is done.Overall I still like it - I've gotten used to having it on, the sleep data is new and interesting, and it's a good run tracker (the GPS is as good if not better than my Garmin - and it definitely finds the satellites quicker). I love the notifications on the Band: text messages, email, Facebook, etc... these could be the things that keep me using it after I get bored of the other stuff :)The negatives are minor, but important for some. The battery realistically only lasts a full day - the minute you use the GPS functionality you're going to have to charge again within 24 hours. People report longer times but I doubt you are really getting the full use of the watch if you're stretching the battery so long. The other hardware issue is the question-mark over the heart-rate sensor ~ I'll leave it for people with more patience than me to do an exhaustive test, but as the disclaimer says "this is not a medical device" and it's probably as good as you can expect for a device of this size.Finally, though, even assuming the battery lasted a week and the HR was spot-on, I would still not be able to use the Band as my only fitness-tracking device, purely because the data is locked into the Microsoft Health ecosystem. While there is no way to export ALL the data (into Strava or similar systems) I'm just not willing to give up my current devices.[...]

Microsoft Band (day 6: data)


Short update today, answering two questions I've heard a lot about the Band:

  • Can the data be exported?
  • Does it work for cycling?

Can data be exported?

The short answer here is "no"; at least I have not found a way to get any of the raw data out of the Band or the Microsoft Health app. There are Connected Apps partners with Microsoft, including RunKeeper, so I signed up for their service to see how much data is shared.

The first problem with Connected Apps is that (apparently) your past data is not shared. This meant that after I joined there was no way for me to upload the half-marathon data from last weekend. New activities, however, seem to appear on RunKeeper as soon as they're sync'd to Health.

The second 'problem' is that only a summary of each activity is available... here is the information available on RunKeeper after a 5 km run this evening:

No details are available in the Connected App - no kilometer splits, elevation chart, map track or heart rate data :-( I would really like to get the running data (heart rate, GPS track as GPX) from my Band activites, and/or sync them automatically with Strava... however if the only integration possible with Strava is a 'summary' such as that shown above - I wouldn't bother!

(image) Interesting statistic shown on the RunKeeper website...
1139 RunKeeper users also use this app
I wonder just how many Bands have been sold so far...

Does it work for cycling?

There's no particular reason why the Band won't collect data (GPS track, heart rate, etc) from a cycling effort as well as a run... I tried it out and it works fine. The problem with this is categorizing that workout in your training records. The speed/average pace recorded for a bike ride will far exceed your running capacity ;) and the heart-rate will be a lot less; making the calorie calculations also useless. 

If metrics are important to you (and they probably are, if you're reading this), then "no" the Band isn't much use for cyclists compared to the myriad of other options available.

Microsoft Band (day 5: rest)


No running after the half-marathon, so I thought I would blog some random info about the Band today.Configuring the Run tileI mentioned that you can change which stats are displayed while running - to do so click on the Band (top-right of screen) and choose Manage Tiles. This shows the list of available tiles with a 'switch' next to each that lets you show/hide the tile on your Band.Some tiles have additional options (indicated by an 'edit pen' icon). Touch the row to configure; in the case of the Run tile it will display a screen explaining the options and an Edit button at the bottom of the screen. The final Run Settings screen lets you click to edit which run statistics are displayed on the Band screen: Finding your historical heart-rate dataI just assumed that the band was monitoring my heart-rate and step-count all the time, but it took me while to find the data in the app. You would expect to access it somewhere in the Activity History screen, but that only contains Runs, Workouts, and Sleeps.Instead touch the steps count on the main screen. This will take you to the rendering for a the current day's steps (as a histogram), with heart-rate graphed in the background. Touch the graph to switch to heart-rate view; or scroll down to view past day's step summary... notice the gap in this data (middle screenshot) -- the Band was off my wrist for charging :-)You can display data for past days by tapping one of the past-day rows. The historical data has a darker header color (almost black, not purple), and you can view the steps and heart-rate data throughout the day... this is half-marathon race day:Flashlight!Just kidding... kinda. There isn't a Flashlight tile... but it is amazing how much light the Band emits when showing the menu (I've chosen a lime green theme, so it's quite bright). In a darkened house I can easily navigate around using the ambient light from the Band's screen...If you want total darkness from your Band, enter sleep mode (if you're actually going to sleep) or else turn Watch Mode off so that the screen doesn't even show the time.[...]

Microsoft Band (day 4: race)


Today I wore both the Band and my Garmin Forerunner 10 in the US Half-marathon (San Francisco) to compare their usability while running and the data they collect.TL;DR I love having the extra data from the Band after the race (eg. heartrate) but without Strava integration to view the data in more detail I can't leave my Garmin behind just yet. Sadly the secondary readouts (heart-rate and distance) on the Band seem too small to read easily while racing.The BandI wore the band on a different wrist to the watch and it definitely felt heavier than the Garmin, however I hardly noticed the difference once I started running. I started the GPS detection at the same time on both devices; the Band was ready to go a lot faster than the Garmin.As I mentioned in an earlier post: I love that the Band has the heart-rate and GPS sensors built-in, so it can do all this without requiring a phone nearby!The RaceWhile running both devices seemed to keep similar distance/pace time, with the km splits being pretty consistently recorded. The Garmin beeps at a km split which is fine, but sometimes I hear the beeps from other runners' watches around me and I look down for a split and it's not there. The Band vibrates so there's no false-positives... I know when I glance down that the split time will be there. The more direct feedback is a nice touch :-)The 'run tile' display looks like this (apols for the image quality):I've configured it via the app Band > Manage Tiles > Run to show heart-rate, distance, and duration. This means the pull-down drawer will show calories and current pace. Double-tapping the action button will cycle between the currently displayed data so that each element occupies the bottom (larger) position. This is useful, since I found it tough to read the two smaller numeric readouts while running... I almost wish the entire display could be set to show one stat really large, and the double-tap could then cycle between that view and the more crowded setup shown above...I mainly glanced down at the Band when it vibrated to indicate a km split; it was slightly easier to read that view (I think because the numbers weren't changing). I didn't find myself looking at the heart-rate display much during the race... maybe because I wasn't sure to do with that information anyway.I used the Garmin more frequently to gauge my progress since I found its display easier to read on-the-run.The ResultsThe main reason to wear both devices was to compare the results - Microsoft Band and Health app versus Garmin Forerunner 10 and Strava - so here they are:SummaryThe Garmin slightly over-estimated the distance (but so did the Band, by slightly less) - they are both accurate enough, but I guess the Band did better. The average pace is the same for both, however the calories estimate is again way off. I've no idea how it decides the Fats and Carbs calorie numbers... nor which is more "correct".The Microsoft Health app has the heart rate info: average, high, and low; and also the Recovery Time which I presume is some sort of indication of how long you should wait before exercising again? They really need to help us out with how interpret some of this stuff!PaceThe pace data for the Band is shown along with the heart rate and elevation in graph form (below). The problem with looking at this information in the app is how compressed it is - you can't easily "zoom in" to see the variations in pace or elevation over time.By contrast, the same data in Strava (minus heart rate, which my Garmin watch doesn't record) is much easier to interpret:Until Microsoft Health has similar visualizations (or they are able to integrate with Strava), I won't be able to use the Band on its own... I like these gra[...]

Microsoft Band (day 3: sleep)


One of the interesting side-effects of how quickly I got used to wearing the Band was that I decided to give the sleep monitoring a try. I had previously been cynical about how comfortable these devices would be to sleep in, let alone wearing it every night... but I'm also curious about the data it collects so I'll be sleeping with it for a while at least :)

This is the sleep data it collected - the night before a half-marathon (and daylight savings switch-over) so it shows me getting up very early. I already know that I wake up through most nights... usually I need water... but it's interesting to see this information tracked accurately. Also interesting to learn how much of the night is actually restful versus light sleep:

I think I usually fall asleep much quicker than 15 minutes, I guess the Band will answer that question too over time.

Tapping on the graph switches to 'heart rate view', more interesting data! Hard to spot any correlations here (eg. between heart rate and restful sleep) but it'll be interesting to revisit after a longer period. The graph looks like this:

The one tricky part about using the Band for sleep monitoring is you lose an opportunity to charge the battery overnight. The device can get to 80% charge pretty quickly (maybe 40 minutes, definitely less than an hour it seems) so my plan is to charge at least that much each morning after waking up.

To get the battery to 100% takes a lot longer, I haven't timed it but seems to be a few hours (?). Not sure why that last 20% takes so long, I guess I'll find out if 80% is enough to get through most days... I've read people are getting at least 2 days of use (notifications, step counting) on a single charge as long as they don't enable GPS. Since I plan to run using GPS tracking daily, will have to wait and see what sort of battery life I get.

Microsoft Band (day 2: pairing)


Sadly, day 2 of my Band experience was not as much fun as day 1.As I was excitedly demonstrating how notifications from my phone appeared on the Band... they stopped appearing :-( I didn't think to try and debug the issue right away, so I just kept the Band on collecting data.Next morning when I went to view my sleep data on my iPhone (more on that in future), the Band wouldn't sync data at all! Just this message:Band error - I can't find your Band. Please make sure it is nearby and paired or go to My Microsoft Band to register a different one.I was immediately pretty concerned! I looked through the menus on the Band but did not find anything helpful. I checked the pairing and it seemed to be paired fine (although I discovered later it wasn't), so I went to My Microsoft Band as they suggested.ARGH! Now it sounds like I am going to lose data :-(Unregister Band? Default tile and notification settings will be erased and you will need to factory reset your Microsoft Band.I panicked some more, and tried the Help feature in the app... OMG Microsoft WTF. Microsoft Health's in-app Help (on a mobile device!) just goes to the Support Home Page on the web (where, by the way, it's impossible to find anything related to Band).Worst. User. Experience. Ever. Finally after much screwing around with various settings, it appears that you need to be paired to TWO "bluetooth devices" for a Band... one with an "LE" suffix and one without (as shown). This is about 30 minutes of various rebooting and re-pairing attempts.I have no idea what caused the pairing to fail in the first place, it just seemed to step receiving notifications at some point, and then not be able to connect at all.Anyway... my Band is back online and all my data appears to be intact. It was not my ideal second-day experience, however; and at this point I'm a little less like to shift to this as my primary running device if the data is potentially lost so easily.I like everything else about it so far though, so I'll keep playing![...]

Microsoft Band (day 1)


I had no clue Microsoft was working on the Band until the reviews starting to leak out last night, but I was immediately keen to try one out. Today I dropped by the Microsoft Store at opening to pick one up, and I'm happy to report it's actually a pretty cool piece of tech.Let me start by saying two things: (1) I really wanted to like the Band ~ smart watches don't really appeal to me but this feels smaller, less obvious and more focused that the Apple and Android devices (2) my primary use-case is running - with GPS and heart rate recording - so that is my measure of the device's success.TL;DR I like the device a lot, my initial impression is that it does what I want while running and it pleasantly surprised me in a lot of other ways as well.FeaturesThe initial setup was painless: I downloaded the Microsoft Health app to my iPhone, paired the Band and was immediately able to receive alerts (texts, voicemail alerts, etc) on the Band. The app was easy enough to figure out: I changed the color scheme and turned on Facebook, Twitter, Notifications... and everything just worked.Using the Band's menu on the phone screen is surprisingly smooth - although I'm not sure how people will bigger hands will find it. The device itself is less bulky than I expected (especially on my small wrist)... don't get me wrong it still feels "big" and looks a little "wide", but it's not heavy and after I'd worn it for a while I barely noticed it.Playing around with heart-rate monitoring, calendar, notifications, alarms, the step counter, the UV detector and the workouts feature was a lot of fun; but as I said my primary concern was using it for run training...RunningI was easily able to figure out how to get everything working, but here is the running "support page" for reference. To be clear - you do NOT need your phone with you while running! The GPS functionality is built-in to the Band, along with the step-counter and heart-rate monitor, so you get plenty of good data while exercising without dragging a phone around :)To compare the accuracy and usability of the Band I wore my Garmin Forerunner 10 for comparison. They both took a while to 'find satellites' (and it always feels like forever when you want to start running), but the Band was actually ready slightly ahead of the Garmin.During the run, they both kept in pretty close sync, beeping out kilometer markers at roughly the same time (and therefore showing similar splits). There was a bit of drift between them but nothing dramatic. The screen of the Band was constantly lit (which was great, as I was running at night), and the elapsed time is pretty easy to read. The heart-rate text is pretty small to read while you're moving unfortunately.Your pace is available by 'swiping down' on the screen while you're running. It auto-hides after a while, returning the display to the elapsed time and heart-rate. I haven't got pictures of these screens and haven't found them on the support site yet. At each kilometer marker (or mile if you must) it beeps and shows your pace-per-kilometer/mile for a few seconds, before again reverting to the elapsed time display.After the run was over, I uploaded my Garmin data to Strava (as I normally do) so I could compare the results. The Band seamlessly sync'd its data to my phone as soon as I opened the Microsoft Health app.Summary DataHere's the summary info from the Microsoft Health app versus Strava's view of my Garmin-collected data. Both compare pretty well - the Calories calculations are fairly different (something to investigate further) but the distance and pace are pretty close. The best thing about the Band is the inclus[...]

iPhone 6 and 6 Plus LaunchScreen.storyboard for Xamarin


Following on from the previous post about adding launch images for iPhone 6 and 6 Plus, here are the instructions for adding a LaunchScreen.storyboard file instead of multiple fixed-size images. Apple's documentation recommends this method over using the static images. I used these instructions for replacing launch images with storyboards as a reference.Configuring a LaunchScreen like this will automatically scale up your app for iPhone 6 and iPhone 6 Plus devices. You might also want to consider adding @3x retina images for iPhone 6 Plus support.1. Add a new Storyboard to your project and call it LaunchScreen.storyboard.2. Drag a UIViewController in and design your launch screen. I chose a black background with some white centered text - it looks like this (use the VIEW AS option to preview in different sizes):3. Open the iPhone application Project Options and scroll down to the iPhone Launch Images section. There is a new Launch Screen dropdown (currently in Beta) that will automatically be populated with the available storyboards and xibs in your project. Choose the storyboard you just added.3a. This creates the following key in your Info.plist (just FYI): UILaunchStoryboardName LaunchScreen4. When you build the app, appropriate launch images will be generated for your app. Here's a shot of the emulator starting up showing the launch image for iPhone 6:I've updated my Xamarin.Forms Todo sample, the code and storyboard are available on github.UPDATE: Gerry reminded me about Marco's experience where adding a LaunchImage.storyboard file causes iOS to ignore the UIDeviceFamily setting in Info.plist (which specifies iPhone/iPod, iPad, or Universal app) and upscale iPhone-only apps to full iPad screen size (potentially making your app look really weird!). This behavior still appears to occur on the simulator, so test before you launch :)[...]

iPhone 6 and 6 Plus Launch Images for Xamarin


I was initially stumped by how to get my Xamarin.iOS and Xamarin.Forms apps to size correctly on the iPhone 6 and iPhone 6 Plus. Thanks to this StackOverflow question & answer I have a solution - reposting here because the solution that works best for me right now is only the 3rd most popular answer there.Simply create two new default images (this is for portrait only, but landscape will become obvious later):Default-667h@2x.png for iPhone 6; dimensions 750x1334Default-736h@3x.png for iPhone 6 Plus; dimensions 1242x2208and place them in the application root or the Resources folder. Notice the filename format is similar to the Default-568h@2x.png image that Apple introduced for the iPhone 5 screen.Now edit the source of your Info.plist file (open in a text editor so you can type XML directly) and add the following UILaunchImages key (the first two items are for iPhone 6, the others are for the older default image configuration):UILaunchImages UILaunchImageMinimumOSVersion 8.0 UILaunchImageName Default-667h UILaunchImageOrientation Portrait UILaunchImageSize {375, 667} UILaunchImageMinimumOSVersion 8.0 UILaunchImageName Default-736h UILaunchImageOrientation Portrait UILaunchImageSize {414, 736} UILaunchImageMinimumOSVersion 7.0 UILaunchImageName Default-568h UILaunchImageOrientation Portrait UILaunchImageSize {320, 568}    UILaunchImageMinimumOSVersion  6.0  UILaunchImageName  Default  UILaunchImageOrientation  Portrait  UILaunchImageSize  {320, 480} I've tested this in my TodoStyled Xamarin.Forms example on Github.If you wish to support landscape images, add matching keys with Default-Landscape-???h filenames and specify the correct orientation and size.Note that this is not Apple's preferred way of indicating support for the screen sizes. Their Launch Images doc says: You use a launch XIB or storyboard file to indicate that your app runs on iPhone 6 Plus or iPhone 6. which requires you to create a Storyboard or XIB using size classes. More on how to do that in this post, or head back to that StackOverflow post!p.s. this iPhone 6 Screens Demystified post by PaintCode is awesome!UPDATED: @jamesmontemagno informs me that you need to add the original 320x480 into the plist too, so I've added to the example above. [...]

Android TextToSpeech API with Xamarin: it talks too!


A recent post covered Apple's new text-to-speech API in iOS 7, but forgot to mention that Android has actually had this capability for a while! It's really easy to add text-to-speech to a Xamarin.Android app: just implement TextToSpeech.IOnInitListener (which is a single method: OnInit) then create a new TextToSpeech instance:

speaker = new TextToSpeech (this, this);

and call Speak:

void Speak(string text) {
var p = new Dictionary ();
speaker.Speak (text, QueueMode.Flush, p);

The TaskyPro sample code has been updated so that both the iOS and Android apps have a Speak button. The Android app looks like this:


Check out this cool TtsSetup sample for Xamarin (via StackOverflow) for more details on how to customize the Android TextToSpeech API.

Built-in Barcode Scanning with iOS7 and Xamarin: MonkeyScan!


Another new iOS 7 feature is built-in support for barcode-scanning via the AVFoundation AVCaptureDevice API. Back in 2012 I threw together MonkeyScan using Windows Azure Services and the ZXing barcode scanning library. For iOS 7 I've updated the code to use the Azure Mobile Services Component and the new iOS 7 barcode scanning API instead.

The app looks like this when scanning a PassKit pass:


The code that sets up an AVCaptureDevice for 'metadata capture' (as opposed to capturing an image or video, I guess :) is shown below:

bool SetupCaptureSession () {
session = new AVCaptureSession();
AVCaptureDevice device =
NSError error = null;
AVCaptureDeviceInput input =
AVCaptureDeviceInput.FromDevice(device, out error);

if (input == null)
Console.WriteLine("Error: " + error);

AVCaptureMetadataOutput output = new AVCaptureMetadataOutput();
var dg = new CaptureDelegate(this);
output.SetDelegate(dg, MonoTouch.CoreFoundation.DispatchQueue.MainQueue);
session.AddOutput(output); // MUST add output before setting metadata types!

output.MetadataObjectTypes = new NSString[]
{AVMetadataObject.TypeQRCode, AVMetadataObject.TypeAztecCode};

AVCaptureVideoPreviewLayer previewLayer = new AVCaptureVideoPreviewLayer(session);
previewLayer.Frame = new RectangleF(0, 0, 320, 290);
previewLayer.VideoGravity = AVLayerVideoGravity.ResizeAspectFill.ToString();
View.Layer.AddSublayer (previewLayer);

return true;

You can specify specific barcodes to recognize or use output.AvailableMetadataObjectTypes to process all supported types.

...and it speaks!
Since the app now requires iOS 7, it can also use the new AVSpeechSynthesizer to speak the scan result as well (see previous post).

if (valid && !reentry) {
View.BackgroundColor = UIColor.Green;
Speak ("Please enter");
} else if (valid && reentry) {
View.BackgroundColor = UIColor.Orange;
Speak ("Welcome back");
} else {
View.BackgroundColor = UIColor.Red;
Speak ("Denied!");

The MonkeyScan github repo has been updated with this code.

iOS SpeechSynthesizer API with Xamarin: it talks!


Mike posted a neat code example today on adding the new iOS 7 AVSpeechSynthensizer API to a Xamarin app.

It's so easy, I added speech synthesis to the this TaskBoard to-do list example in about 5 lines of code. Now the app can read the to-do item back to you :) just by adding this code:

if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
SpeakButton.TouchUpInside += (sender, e) => { // requires iOS 7
Speak (TitleText.Text + ". " + NotesText.Text);


void Speak (string text) {
var speechSynthesizer = new AVSpeechSynthesizer ();

var speechUtterance = new AVSpeechUtterance (text) {
Rate = AVSpeechUtterance.MaximumSpeechRate/4,
Voice = AVSpeechSynthesisVoice.FromLanguage ("en-AU"),
Volume = 0.5f,
PitchMultiplier = 1.0f

speechSynthesizer.SpeakUtterance (speechUtterance);

The UI now looks like this: touch the Speak button to hear the text read back to you.


New Dropbox API one day, on Xamarin the next


Long-time Xamarin customers know that there is a history of delivering updates same day when the native platforms (iOS and Android, for example) are upgraded. Today there was another little surprise - the new Dropbox Datastore API that was announced at DBX yesterday was made available via a Xamarin Component today! Think of it as a cross-platform iCloud-like key-value store ~ same kind of stuff you can do with Parse or even Azure Mobile Services. Check out the Xamarin Blog for all the details and a cute sample app called MonkeyBox. But wait, there's more! In the past I've posted about porting a small "To Do List" application to various different platforms, including Azure (iOS, Android, Mac and more) twice as well as an iCloud version for iOS. Here's the same basic code using the new Dropbox Datastore API (just iOS, for now...): Here's a direct link to the code on github... to use just download the solution (which includes the Xamarin Dropbox Component) and: Visit the Dropbox App Console to get your access credentials set-up. Add the App key and App secret to the AppDelegate.cs in the project.Add a Custom URL Type to the advanced Info.plist settings (replacing the identifier and also YOUR_APP_KEY with the correct credential value) like thisWhen the app is up-and-running, you can 'browse datastores' from the Dropbox App Console and see the data update on the server in real-time!In only a few lines of code you can use a cloud-based data store simply and easily, across multiple platforms and devices! Load up the app on a couple of iOS devices (and/or the iOS Simulator) and watch the magic in action :)[...]

Xamarin for Java Developers


Last night I was given the opportunity to present Xamarin's Mono for Android to the East Bay Google Developer Group. It was a lot of fun, with plenty of the audience asking a lot of great questions and generally being curious about how C# can be used to build Android apps. Here are the slides from the talk - please drop me a line with any feedback or questions! src="" width="427" height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> One topical question was "what does using Xamarin and C# offer existing Android Java developers?". I have a couple of thoughts which are listed below (in no particular order): Learn a new language!The days of specializing in a single language throughout your career (or even throughout the year!) are over. Once upon a time it was COBOL all the way down, and you could argue that it's still enough to just know C/C++. But it's no longer the norm ~ developers want to grow and learn, and use the best tool for the job (whether it's Perl, PHP, Java, Ruby, C#, F#, Javascript, TypeScript, Go, or whatever). It can be daunting though, to start from scratch and learn a new IDE, framework and syntax - which is why I think C# is a great progression for Java devs. The two languages are obviously related - there is a lot of common syntax and equivalent keywords that make it easy to get proficient quickly. They're both strongly typed, so the IDE and compiler can really help you learn. Then once you know the C# basics, a whole world of new APIs open up to you: LINQ, the .NET framework's serialization and web service features, Parallel Task Library and async support, reactive extensions, and more. It also introduces you to another IDE (Visual Studio is a great tool, as is Xamarin's free MonoDevelop IDE), which in turn can encourage you to further explore other languages and platforms (suddenly it's a small leap to work on Windows Phone, or try F#). Using the free trial you can easily get productive in C# and Android development without any up-front cost: you can run your apps on the Android emulator, and choose to work on either Windows or Mac with MonoDevelop. Cross-platform development!There are a lot of Java developers who are already proficient with the Android SDK and have published successful apps to Google Play, or Amazon, or Samsung app stores; and there's another group of corporate/enterprise developers building apps for internal/extranet use that were designed for Android. When these developers ask "why Xamarin?", I never say "throw away everything you've done and re-write in C#!" -- that'd be crazy ;-) But what happens when you want to take these apps cross-platform, either to make more money on the iOS and Mac App Stores or to better support a corporate BYOD policy which means your internal apps need to run on iOS and Windows? You can choose to learn Objective-C to write for iOS and C# for Windows... or take the opportunity provided by Xamarin to use C# for all the non-Java platforms and reduce the amount of code you have to support and re-write by half! Following on from the first point, I think learning C# is a much smaller leap for a Java developer than Objective-C; and once you've done so you can work on either iOS apps using Xamarin's MonoTouch or Windows Phone, Windows 8 [...]

Localizing iOS6 Storyboards with MonoTouch


Localization and internationalization of XIB and Storyboard files has historically been a very manual process. Typically these file types would be duplicated in each 'language directory' (*.lproj) and then the text and layout tweaked independently by each translator. Changes to the actual Storyboard or XIBs would need to be manually propagated across all the 'language copies'.In iOS6 Apple introduced a new concept - Base Localization - which you can read about in their documentation on Internationalizing Your App. Your project can contain a 'special' Base.lproj directory where the Storyboard files are located, and then a corresponding *.strings file (whose filename matches the Storyboard's) in each language directory with the translations.There is a small sample showing how this works with MonoTouch - TaskyL10nStoryboard on github. There is no IDE support currently, but you can easily create the Base.lproj directory manually in MonoDevelop and everything works as expected. Here's a screenshot of the project structure: then inside the Storyboard itself you need to identify the controls you wish to localize. Click on a control to discover its Object ID, and shown in this screenshot: Using the Object IDs from the Storyboard file, we can translate the display values for various properties (including text, placeholders and others) in the MainStoryboard.strings file in each language directory, like this:"SXg-TT-IwM.placeholder" = "nombre de la tarea";"Pqa-aa-ury.placeholder"= "otra información de tarea";"zwR-D9-hM1.text" = "Detalles de la tarea";"bAM-2j-Rzw.text" = "Notas";"NF3-h8-xmR.text" = "Completo";"MWt-Ya-pMf.normalTitle" = "Guardar";"IGr-pR-05L.normalTitle" = "Eliminar";Using the Object ID and property as the localization key is quite different to Apple's previous guidance on localization, where the key is typically the base-language's actual displayable value.Here's the localized Storyboard, in Japanese:What about layout?Strings can often be very different lengths in different languages. When you used a different Storyboard or XIB for each language then the control sizes could be manually adjusted to fit. When using Base Localization you should use Apple's new constraint-based layout to handle these size differences.What about iOS5 and earlier?This method only works on iOS6. To localize text on earlier versions of iOS you will have to duplicate your Storyboards and XIBs for each language, or create outlets for all the controls and set their localized text values in code using NSBundle.MainBundle.LocalizedString().There is another localized sample - TaskyL10n - which shows how to localize text elements directly and uses MonoTouch.Dialog.[...]