tag:blogger.com,1999:blog-66215612024-03-13T20:40:52.435-07:00ConceptDev (Craig Dunn's blog)Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.comBlogger338125tag:blogger.com,1999:blog-6621561.post-42989977280072896622016-05-14T13:26:00.000-07:002016-05-14T13:27:47.420-07:00Xamarin.Forms Workbooks<div dir="ltr" style="text-align: left;" trbidi="on">
As explained in the <a href="http://conceptdev.blogspot.com/2016/05/xamarin-workbooks-with-nugets.html">last post</a>, it's easy to add Nuget packages to <a href="https://developer.xamarin.com/guides/cross-platform/workbooks/">Xamarin Workbooks</a>. 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 <i>iOS </i>Workbook):<br />
<br />
<b>1. Add the Xamarin.Forms nuget (and reference the platform)</b><br />
<br />
When you add the Xamarin.Forms Nuget, four assemblies will be referenced (including the iOS Platform assembly for Xamarin.Forms). The <span style="font-family: "courier new" , "courier" , monospace;">using</span> statements need to be added too - don't forget to add the <span style="font-family: "courier new" , "courier" , monospace;">Xamarin.Forms.Platform.iOS</span> namespace:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Qfs2WSs-wck/VzeDciKYDhI/AAAAAAAEBcs/4d6YbpuhhDgu3vosSD3xGym--CYu6E5rwCLcB/s1600/forms.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="96" src="https://1.bp.blogspot.com/-Qfs2WSs-wck/VzeDciKYDhI/AAAAAAAEBcs/4d6YbpuhhDgu3vosSD3xGym--CYu6E5rwCLcB/s200/forms.png" width="200" /></a></div>
<br />
<br />
<b>2. Create a <span style="font-family: "courier new" , "courier" , monospace;">Page</span> and <span style="font-family: "courier new" , "courier" , monospace;">App</span> as usual</b><br />
<br />
In both classes it's a good idea to create public properties for elements you want to manipulate in the workbook.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-pbGg8obpNNA/VzeEqfE0kmI/AAAAAAAEBc0/yS7ShgDmoo0fONsXhyV4tCWzzyEaOdjGQCLcB/s1600/forms-app.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="314" src="https://3.bp.blogspot.com/-pbGg8obpNNA/VzeEqfE0kmI/AAAAAAAEBc0/yS7ShgDmoo0fONsXhyV4tCWzzyEaOdjGQCLcB/s320/forms-app.png" width="320" /></a></div>
<br />
This allows those controls to be referenced later in the workbook...<br />
<br />
<b>3. Hack the FormsAppDelegate</b><br />
<br />
The biggest hurdle to getting Xamarin.Forms to run is that in a <i>normal</i> iOS app, the <span style="font-family: "courier new" , "courier" , monospace;">AppDelegate</span> must be a subclass of <span style="font-family: "courier new" , "courier" , monospace;">FormsApplicationDelegate</span> to wire up various bits of Xamarin.Forms. Peeking into the <a href="https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs">open-source</a>, the key thing we need to do is set the <span style="font-family: "courier new" , "courier" , monospace;">RootViewController</span>... the following code does the initialization we need to get a Workbook running:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-oZSxzPhXEyk/VzeE4k2B5ZI/AAAAAAAEBc8/U7JpT4V8VjYlDYrfKcHmjNChhd01ROWXwCLcB/s1600/forms-init.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="59" src="https://4.bp.blogspot.com/-oZSxzPhXEyk/VzeE4k2B5ZI/AAAAAAAEBc8/U7JpT4V8VjYlDYrfKcHmjNChhd01ROWXwCLcB/s320/forms-init.png" width="320" /></a></div>
<br />
<b>WARNING:</b> obviously this approach misses some of the other code implemented in <span style="font-family: "courier new" , "courier" , monospace;">FormsApplicationDelegate</span> so some things might not work as expected. This is a bit of a hack :)<br />
<br />
<b>4. Run It</b><br />
<br />
The public properties on the App and Page classes mean the workbook can manipulate those elements to demonstrate various Xamarin.Forms capabilities.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-dkFNaRZdNOY/VzeGkiAdbxI/AAAAAAAEBdI/MbrBGXJv2ps3LIepjE16zsD1wpeMdGGtgCLcB/s1600/runit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="35" src="https://4.bp.blogspot.com/-dkFNaRZdNOY/VzeGkiAdbxI/AAAAAAAEBdI/MbrBGXJv2ps3LIepjE16zsD1wpeMdGGtgCLcB/s320/runit.png" width="320" /></a></div>
<br />
<br />
Try it out with the <a href="https://github.com/conceptdev/xamarin-workbook-samples/blob/master/Xamarin.Forms/WorkbookFormsTest.workbook">WorkbookFormsTest</a> workbook:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-WtyOPId0Ciw/VzeIbXJsCKI/AAAAAAAEBdU/fNxtMpNQNo09f3ftTUR8gvVto3nWAleuwCLcB/s1600/FormsWorkbookTest.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="280" src="https://2.bp.blogspot.com/-WtyOPId0Ciw/VzeIbXJsCKI/AAAAAAAEBdU/fNxtMpNQNo09f3ftTUR8gvVto3nWAleuwCLcB/s400/FormsWorkbookTest.png" width="400" /></a></div>
<br />
<br />
Check out the more complex <a href="https://github.com/conceptdev/xamarin-workbook-samples/blob/master/Xamarin.Forms/ListView1.workbook">ListView1</a> workbook too:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-XYlg9E35pu8/VzeI43Uk_bI/AAAAAAAEBdY/3Dh6nhTk2mk177Crh6dwxKOmEGiOT53EgCLcB/s1600/ListView1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="278" src="https://2.bp.blogspot.com/-XYlg9E35pu8/VzeI43Uk_bI/AAAAAAAEBdY/3Dh6nhTk2mk177Crh6dwxKOmEGiOT53EgCLcB/s400/ListView1.png" width="400" /></a></div>
<br />
<br />
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 <a href="https://developer.xamarin.com/guides/cross-platform/workbooks/">Xamarin Workbooks</a> to try these samples out :D</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-47223587543833738532016-05-14T12:31:00.002-07:002016-05-14T13:31:03.079-07:00Xamarin Workbooks with Nugets<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="https://developer.xamarin.com/guides/cross-platform/workbooks/" target="_blank">Xamarin Workbooks</a> are getting better and better (check out the <a href="http://conceptdev.blogspot.com/2016/04/introducing-xamarin-workbooks.html" target="_blank">intro to Workbooks</a> if you don't know what I'm talking about).<br />
<br />
Nuget packages can now be added, meaning you can teach or demo almost anything in a Workbook :)<br />
<br />
In the Workbook app, choose <b>File > Add Package...</b> to open the Nuget package explorer:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-M8l50ZRN4Sg/Vzd6mJtGzmI/AAAAAAAEBcI/GRh7oH811nYZSJB8oUkgftTHqKSe5yj4gCLcB/s1600/add-package-sml.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="127" src="https://4.bp.blogspot.com/-M8l50ZRN4Sg/Vzd6mJtGzmI/AAAAAAAEBcI/GRh7oH811nYZSJB8oUkgftTHqKSe5yj4gCLcB/s320/add-package-sml.png" width="320" /></a></div>
<br />
Then search for the Nuget and add to the workbook:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-FE2hWHdS58E/Vzd6mHQf8tI/AAAAAAAEBcM/X5AulichT5ocBnQk32zpZKlIH5rBowsJACLcB/s1600/add-newtonsoft-sml.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="119" src="https://1.bp.blogspot.com/-FE2hWHdS58E/Vzd6mHQf8tI/AAAAAAAEBcM/X5AulichT5ocBnQk32zpZKlIH5rBowsJACLcB/s320/add-newtonsoft-sml.png" width="320" /></a></div>
<br />
Try out this <a href="https://github.com/conceptdev/xamarin-workbook-samples/blob/master/Nuget/JsonNET1.workbook" target="_blank">Json.NET Workbook example</a> to see how it works<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-bHx8a4hOvuA/Vzd691FTDEI/AAAAAAAEBcQ/hq7Eo2rnRKA9qzCLu4Cb3CR8MuKvM95jACLcB/s1600/JsonNET1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-bHx8a4hOvuA/Vzd691FTDEI/AAAAAAAEBcQ/hq7Eo2rnRKA9qzCLu4Cb3CR8MuKvM95jACLcB/s320/JsonNET1.png" width="303" /></a></div>
<br />
Coming up next - adding the <a href="http://conceptdev.blogspot.com/2016/05/xamarinforms-workbooks.html">Xamarin.Forms</a> nuget!<br />
<br />
p.s. for a video demo of Nugets in Workbooks, check out this community contribution on <span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-align: justify;"><a href="https://brax.tv/lesson/doc-apis-xamarin-workbook-nuget/">brax.tv</a></span><br />
<span class="comment-actions secondary-text" id="bc_0_7MN" kind="m" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"></span></div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-53093278022504143062016-04-25T08:37:00.002-07:002016-05-14T12:42:16.827-07:00Xamarin Evolve 5k<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Update: </b>thanks everyone who ran!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-JM6jmAar_QY/Vzd_ZNdZr6I/AAAAAAAEBcg/ewcZZvED7jwVMkN-JekcLr4pV80EXa1XACLcB/s1600/FullSizeRender.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://2.bp.blogspot.com/-JM6jmAar_QY/Vzd_ZNdZr6I/AAAAAAAEBcg/ewcZZvED7jwVMkN-JekcLr4pV80EXa1XACLcB/s640/FullSizeRender.jpg" width="640" /></a></div>
<br />
<br />
<br />
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 <a href="https://twitter.com/conceptdev" target="_blank">@conceptdev</a> for twitter updates.<br />
<br />
<b>Date:</b> Wednesday 27th (first day of conference, before the keynote)<br />
<b>Time:</b> 6:15am<br />
<b>Place:</b> outside Hyatt reception (near the flagpoles)<br />
<br />
<b>The Course</b><br />
<b><br /></b>
We'll run a flat 5km (3.2 mile) loop anti-clockwise around the conference center and surrounds:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-dYccVbvCeMs/Vx44It62D2I/AAAAAAAD708/es0-bt9adR0sStY8q8eI-A5D_Woj7hKRACLcB/s1600/xamarun.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://4.bp.blogspot.com/-dYccVbvCeMs/Vx44It62D2I/AAAAAAAD708/es0-bt9adR0sStY8q8eI-A5D_Woj7hKRACLcB/s320/xamarun.png" width="292" /></a></div>
<br />
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:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-7rzogIQVsm0/Vx447ai5WFI/AAAAAAAD71E/B6oLyG22_R0VQV4teoSDVYSSNvVPpPe4gCLcB/s1600/IMG_6229.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://2.bp.blogspot.com/-7rzogIQVsm0/Vx447ai5WFI/AAAAAAAD71E/B6oLyG22_R0VQV4teoSDVYSSNvVPpPe4gCLcB/s320/IMG_6229.JPG" width="240" /></a></div>
<br />
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!<br />
<br />
<br /></div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-36766302695370670252016-04-04T22:04:00.002-07:002016-04-04T22:05:08.874-07:00Introducing Xamarin Workbooks<div dir="ltr" style="text-align: left;" trbidi="on">
The first public demonstration of Xamarin's new Workbooks idea was Miguel de Icaza's <b>//build 2016</b> talk <a href="https://channel9.msdn.com/Events/Build/2016/B836" target="_blank">"Mobile First"</a> (although he first wrote about it <a href="http://tirania.org/blog/archive/2016/Feb-17.html" target="_blank">back in February</a>). 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-GBx76v9pfNY/VwNGP1GuUbI/AAAAAAAD7g4/96SLlt9RYxk4zGsT6LlyJgD9s89PvN_Vg/s1600/urho-workbook.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="171" src="https://2.bp.blogspot.com/-GBx76v9pfNY/VwNGP1GuUbI/AAAAAAAD7g4/96SLlt9RYxk4zGsT6LlyJgD9s89PvN_Vg/s320/urho-workbook.png" width="320" /></a></div>
<br />
<br />
This opens up a great opportunity to write and share interactive documentation that not only describes an API or feature, but <i>shows it in action</i>. Further, it's easy to write, being based on the well-known Markdown format.<br />
<h3 style="text-align: left;">
Give it a try!</h3>
You can now try Workbooks for yourself! The editor can be <a href="https://developer.xamarin.com/guides/cross-platform/workbooks/install/#Download_and_Installation" target="_blank">downloaded here</a>, and there is some <a href="https://developer.xamarin.com/guides/cross-platform/workbooks/" target="_blank">Workbook documentation</a> on the Xamarin developer portal.<br />
<br />
I've thrown together a few very simple ideas <a href="https://github.com/conceptdev/xamarin-workbook-samples" target="_blank">on github</a>:<br />
<br />
<ul style="text-align: left;">
<li><a href="https://github.com/conceptdev/xamarin-workbook-samples/tree/master/Csharp6" target="_blank">C# 6</a> - an interactive workbook version of Xamarin's <a href="https://developer.xamarin.com/guides/cross-platform/advanced/csharp_six/" target="_blank">C# 6 Overview</a>.</li>
<li><a href="https://github.com/conceptdev/xamarin-workbook-samples/tree/master/Mastermind" target="_blank">Mastermind</a> - an attempt to build a simple game.</li>
<li><a href="https://github.com/conceptdev/xamarin-workbook-samples/tree/master/MagicEightBall" target="_blank">Magic Eight Ball</a> - since I've built that for a number of different platforms previously:</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://raw.githubusercontent.com/conceptdev/xamarin-workbook-samples/master/Screenshots/8ball-inspector-sml.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://raw.githubusercontent.com/conceptdev/xamarin-workbook-samples/master/Screenshots/8ball-inspector-sml.png" width="275" /></a></div>
<div>
See <a href="https://channel9.msdn.com/Events/Build/2016/B836" target="_blank">Miguel's talk</a> (if you didn't already) for a really cool demo.</div>
<br />
<h3 style="text-align: left;">
Some Notes</h3>
<br />
<ol style="text-align: left;">
<li>They're written in Markdown, but with a <b>.workbook</b> file extension.</li>
<li>Each file begins with a small JSON-formatted metadata section. The editor will add this for you.</li>
<li>C# code inside triple-backtick code fences will be executed when the file is viewed in the Workbooks editor. </li>
</ol>
There's sure to be other resources popping up now that the project preview is publicly available -- <a href="https://brax.tv/lesson/intro-to-using-a-xamarin-workbook/" target="_blank">Ben Bishop's video</a> is the first community resource I've seen. Can't wait to see what everyone creates with it!</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com8tag:blogger.com,1999:blog-6621561.post-70233955968794312892015-09-29T23:09:00.001-07:002015-09-30T10:22:12.020-07:00iOS 9-ify your Xamarin.Forms App<div dir="ltr" style="text-align: left;" trbidi="on">
It's not just <a href="http://conceptdev.blogspot.com/2015/09/ios-9-ify-your-xamarin-app.html" target="_blank">regular Xamarin.iOS apps</a> that can implement fancy iOS 9 features :) Check out the quick hacks I did to this <a href="https://github.com/conceptdev/xamarin-forms-samples/tree/master/RestaurantGuide" target="_blank">Restaurant Guide Xamarin.Forms sample</a> to add iOS 9 features:<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="270" src="https://www.youtube.com/embed/z7xW2jtWmjA" width="480"></iframe><br />
<br />
<br />
<br />
Mostly using the magic of <a href="http://developer.xamarin.com/guides/cross-platform/xamarin-forms/dependency-service/" target="_blank">Dependency Service</a> I added:<br />
<ul>
<li><a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/search/nsuseractivity/" target="_blank">NSUserActivity</a> for Siri integration with Reminders (and hopefully Handoff)</li>
<li><a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/search/corespotlight/" target="_blank">CoreSpotlight</a> for content search</li>
<li>3D Touch <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/3dtouch/#Quick_Actions" target="_blank">Application Shortcuts</a> on the home screen (for iPhone 6s)</li>
</ul>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-t5tjK7Ku430/VgwZ4lpl0FI/AAAAAAAACyA/UE_S6Xf5YnQ/s1600/3dtouch.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-t5tjK7Ku430/VgwZ4lpl0FI/AAAAAAAACyA/UE_S6Xf5YnQ/s320/3dtouch.png" width="158" /></a><a href="http://4.bp.blogspot.com/-Z8BAAypkIJE/VgwZv7JpDyI/AAAAAAAACx4/7e_yQ_fNhDI/s1600/search.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-Z8BAAypkIJE/VgwZv7JpDyI/AAAAAAAACx4/7e_yQ_fNhDI/s320/search.png" width="158" /></a></div>
<br />
<br />
No special work was required to get the app running with <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/multitasking/" target="_blank">iPad Multitasking</a>, other than to ensure there was a Storyboard (or XIB) Launchscreen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-FpIHBIyoddQ/VgwWpKubdaI/AAAAAAAACxs/3lN8w-LDd4g/s1600/multitask.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="249" src="http://1.bp.blogspot.com/-FpIHBIyoddQ/VgwWpKubdaI/AAAAAAAACxs/3lN8w-LDd4g/s320/multitask.png" width="320" /></a></div>
<br /></div>
<div>
<br /></div>
<div>
Finally, I added the <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/ats/#Opting-Out_of_ATS" target="_blank">Application Transport Security</a> "opt-out" tags to the Info.plist file, so that the links to all the different restaurants would work in the WebView control.</div>
<div>
<br /></div>
<div>
Download the <a href="https://github.com/conceptdev/xamarin-forms-samples/tree/master/RestaurantGuide" target="_blank"><b>code from github</b></a> to try for yourself!</div>
<div>
<br /></div>
<div>
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 ;)</div>
</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-82055078811056318112015-09-27T10:11:00.001-07:002015-09-27T10:11:15.305-07:00iOS 9-ify your Xamarin App<div dir="ltr" style="text-align: left;" trbidi="on">
With the iPhone 6s models now available, it's possible to build <i>and test </i>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: <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/To9o">To9o app</a> (that's "Todo" but with a "9" :-) The <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/To9o">c# code</a> is on github and screenshots of each iOS 9 feature are shown below.<br />
<h3 style="text-align: left;">
<b>3D Touch</b></h3>
<div>
3D 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:</div>
<ul style="text-align: left;">
<li><a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/3dtouch/#Quick_Actions" target="_blank">Application Shortcuts</a></li>
<li><a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/3dtouch/#Peek_and_Pop" target="_blank">Peek and Pop</a></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-_swet6JzIYM/Vggc1wpOupI/AAAAAAAACwI/UUCprWFFT3E/s1600/shortcut.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-_swet6JzIYM/Vggc1wpOupI/AAAAAAAACwI/UUCprWFFT3E/s320/shortcut.png" width="179" /></a>
<a href="http://1.bp.blogspot.com/-01GKQYvJ92A/Vggc1bP587I/AAAAAAAACwA/PjMZFb2TIQc/s1600/peek.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-01GKQYvJ92A/Vggc1bP587I/AAAAAAAACwA/PjMZFb2TIQc/s320/peek.png" width="179" /></a> </div>
<br />
<h3 style="text-align: left;">
Multitasking for iPad</h3>
If the app can resize its UI appropriately, it should work fine for <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/multitasking/" target="_blank">multi-tasking</a>!<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-xSf8qEUgZ7U/VggauCipN1I/AAAAAAAACvw/7P0PwygXJaw/s1600/ipad.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/-xSf8qEUgZ7U/VggauCipN1I/AAAAAAAACvw/7P0PwygXJaw/s320/ipad.png" width="320" /></a></div>
<br />
<h3 style="text-align: left;">
ContactsUI</h3>
The "Todo" app doesn't traditionally need an interface to the <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/contacts/" target="_blank">Contacts</a> list, but I added it just to give this new API a try :)<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-av0tjwGVd-o/Vggd2Tq2NqI/AAAAAAAACwQ/dmpCBxXzp2I/s1600/contactsui.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="83" src="http://4.bp.blogspot.com/-av0tjwGVd-o/Vggd2Tq2NqI/AAAAAAAACwQ/dmpCBxXzp2I/s400/contactsui.png" width="400" /></a></div>
<br />
<h3 style="text-align: left;">
New Search APIs</h3>
<div>
The new search APIs let you expose content to search and Siri. I've added both:</div>
<ul>
<li><a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/search/corespotlight/" target="_blank">CoreSpotlight</a></li>
<li><a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/search/nsuseractivity/" target="_blank">NSUserActivity</a></li>
</ul>
Notice the <i>Back to Search</i> button in the navigation bar.<br /><ul>
</ul>
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-g9CIzMV3WTg/VggeXjS1A-I/AAAAAAAACwc/1VjODI1I_-w/s1600/search.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-g9CIzMV3WTg/VggeXjS1A-I/AAAAAAAACwc/1VjODI1I_-w/s320/search.png" width="179" /></a><a href="http://2.bp.blogspot.com/-GACzQMWSIoQ/VggeXUR-9JI/AAAAAAAACwY/UFppSPzIDQI/s1600/search2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-GACzQMWSIoQ/VggeXUR-9JI/AAAAAAAACwY/UFppSPzIDQI/s320/search2.png" width="179" /></a></div>
<h3 style="text-align: left;">
UIStackView</h3>
This <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/uistackview/" target="_blank">new layout option</a> makes it much easier to build screens that 'scale', and also makes it even easier to support RTL languages (see below).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-hAiKc5KaJtE/Vggb6yysH3I/AAAAAAAACv4/1_-N9Aj82ro/s1600/stackview.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="280" src="http://2.bp.blogspot.com/-hAiKc5KaJtE/Vggb6yysH3I/AAAAAAAACv4/1_-N9Aj82ro/s320/stackview.png" width="320" /></a></div>
<i>* Note: currently UIStackViews must be drawn using Xamarin's Xcode integration, but the built-in Xamarin iOS Designer will support them soon!</i><br />
<h3 style="text-align: left;">
Collection View Changes</h3>
<div>
The main Todo list is a <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/uicollectionview/" target="_blank">UICollectionView</a> rather than a table, so it can demonstrate how easy it now is to <i>re-order</i> items with two simple methods added in code.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-IfEitKLm554/Vggf0Rm1CUI/AAAAAAAACw4/7oQs-PX-OJw/s1600/reorder.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="199" src="http://2.bp.blogspot.com/-IfEitKLm554/Vggf0Rm1CUI/AAAAAAAACw4/7oQs-PX-OJw/s320/reorder.png" width="320" /></a></div>
<br /></div>
<h3 style="text-align: left;">
Right-to-Left Language Support</h3>
<div>
The entire app can now automatically flip (including UINavigationController animations) when <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/#rtl" target="_blank">displaying RTL languages</a> like Arabic and Hebrew (note: machine translation used for example, apologies for any inaccuracies).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-zIT7EffZYP4/Vggg8srAQ5I/AAAAAAAACxE/0_zhbcIP-nI/s1600/arabic1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://1.bp.blogspot.com/-zIT7EffZYP4/Vggg8srAQ5I/AAAAAAAACxE/0_zhbcIP-nI/s200/arabic1.png" width="200" /></a><a href="http://3.bp.blogspot.com/-ieOYHd_J5_c/Vggg8uktPdI/AAAAAAAACxI/hLInHGp9waA/s1600/arabic2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://3.bp.blogspot.com/-ieOYHd_J5_c/Vggg8uktPdI/AAAAAAAACxI/hLInHGp9waA/s200/arabic2.png" width="200" /></a></div>
<br />
<h3 style="text-align: left;">
SFSafariViewController</h3>
This <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/additional-framework-changes/#Displaying-a-Website" target="_blank">new API</a> 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-7QWknIB93f0/VggfLN_l8sI/AAAAAAAACwo/GrGRS1M3JmM/s1600/sfsafari.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-7QWknIB93f0/VggfLN_l8sI/AAAAAAAACwo/GrGRS1M3JmM/s320/sfsafari.png" width="179" /></a></div>
<br />
<br /></div>
<div>
All these improvements are explained in <a href="http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/">Xamarin's iOS 9 docs</a>, and the <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/To9o">code</a> is available to review. It is still a work-in-progress so check back for more updates. </div>
</div>
</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-18920302671015370022015-03-18T21:25:00.000-07:002015-03-18T21:48:45.933-07:00Microsoft Band SDK + Xamarin<div dir="ltr" style="text-align: left;" trbidi="on">
Band-fans were happy to see Microsoft release their Java <a href="http://developer.microsoftband.com/">Android SDK for Microsoft Band</a> a few weeks ago, and their Objective-C <a href="http://developer.microsoftband.com/">iOS SDK</a> this week. Xamarin was then able to <a href="http://blog.xamarin.com/microsoft-band-sdk-now-available/">almost immediately release</a> the <a href="https://components.xamarin.com/view/microsoft-band-sdk">Microsoft Band SDK component</a> for iOS and Android, giving you the same functionality but entirely in C# for all three mobile platforms...<br />
<br />
I decided to give it a try, converting my "magic eight ball" apps for <a href="https://github.com/conceptdev/xamarin-forms-samples/tree/master/MagicEightBall">Xamarin.Forms</a> and <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/Watch8Ball">Apple Watch</a> to the Band. The idea is: you shake your wrist and the "prediction" appears on the Band!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-9q2vkGzd5No/VQpIgMfDVeI/AAAAAAAACmk/JNwDIRBPIZ8/s1600/band.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-9q2vkGzd5No/VQpIgMfDVeI/AAAAAAAACmk/JNwDIRBPIZ8/s1600/band.png" height="188" width="320" /></a></div>
<br />
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.<br />
<br />
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".<br />
<br />
The Android app is simple, it contains only a <b>Connect</b> button to connect to the Band, and a <b>Vibrate</b> button to test the connection (plus a label that displays the "prediction" text that is sent to the Band).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-5kHSaYflL0Y/VQpJOsI5FHI/AAAAAAAACms/Q64KKVMDMxU/s1600/android.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-5kHSaYflL0Y/VQpJOsI5FHI/AAAAAAAACms/Q64KKVMDMxU/s1600/android.png" height="320" width="180" /></a></div>
<br />
The code for this Android sample is <a href="https://github.com/conceptdev/xamarin-samples/tree/master/MicrosoftBand">available on github</a>, hopefully I'll get the iOS version running soon.<br />
<br />
If you want to get more info about developing for the Band, check out <a href="http://twitter.com/mattleibow">Matt</a>'s <a href="http://dotnetdevaddict.co.za/projects/microsoft-band-sdk-for-xamarin-android">detailed blogpost with code</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-KY3FOnob8Kw/VQpVGlfl5DI/AAAAAAAACnc/JIrMufWiHmE/s1600/Screen%2BShot%2B2015-03-18%2Bat%2B9.48.07%2BPM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-KY3FOnob8Kw/VQpVGlfl5DI/AAAAAAAACnc/JIrMufWiHmE/s1600/Screen%2BShot%2B2015-03-18%2Bat%2B9.48.07%2BPM.png" height="118" width="400" /></a></div>
<br />
<br />
Finally, Microsoft built a quite detailed Android app that demonstrates all aspects of their SDK, and Matt did an amazing job of <a href="https://github.com/mattleibow/Microsoft-Band-SDK-Bindings/tree/master/Demos/Microsoft.Band.Sample/Microsoft.Band.Android.Sample">porting it to Xamarin</a> - check that out too!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-ja_k50g05-s/VQpOLgI0f-I/AAAAAAAACm8/MsaqPilOh5c/s1600/sample1.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-ja_k50g05-s/VQpOLgI0f-I/AAAAAAAACm8/MsaqPilOh5c/s1600/sample1.png" height="320" width="180" /></a> <a href="http://4.bp.blogspot.com/-Xq5QQyQAHh8/VQpOLgx0XKI/AAAAAAAACnI/DstuaCoOIx4/s1600/sample2.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-Xq5QQyQAHh8/VQpOLgx0XKI/AAAAAAAACnI/DstuaCoOIx4/s1600/sample2.png" height="320" width="180" /></a> <a href="http://1.bp.blogspot.com/-2w8S7syr1JI/VQpOLgdwY_I/AAAAAAAACnA/HLrbwGBeA6E/s1600/sample3.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-2w8S7syr1JI/VQpOLgdwY_I/AAAAAAAACnA/HLrbwGBeA6E/s1600/sample3.png" height="320" width="180" /></a></div>
<br />
<br />
<br /></div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-65327211734164241022015-02-21T15:36:00.000-08:002015-04-16T16:01:55.664-07:00Apple Watch Kit round-up<div dir="ltr" style="text-align: left;" trbidi="on">
It's Saturday, a good excuse for a 'fun' post. Here's a little collection of tidbits about the Apple Watch...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-QmRelW1tauk/VOkXkO6fCKI/AAAAAAAACl0/9Cuc68wtRmU/s1600/slides.006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-QmRelW1tauk/VOkXkO6fCKI/AAAAAAAACl0/9Cuc68wtRmU/s1600/slides.006.jpg" height="225" width="400" /></a></div>
<br />
<br />
<a href="https://developer.apple.com/watchkit/" target="_blank">Apple: Watch Kit</a> - if you're thinking of developing for the platform, might as well start at the source :)<br />
<br />
<a href="http://www.wareable.com/apple-watch/best-apple-watch-apps-832" target="_blank">Wareable: The best Apple Watch apps...</a> - some great screenshots of apps already being built, including <b>Clear</b>, <b>BMW</b>, and <b>Nike</b>. It's interesting to see the UI design approach being taken by different developers. Check out the similar list on <a href="http://www.ibtimes.com/apple-watch-features-10-really-useful-apps-worth-waiting-1687368">ibtimes.com</a><br />
<br />
<a href="http://watchaware.com/watch-apps">WatchAware: Watch Apps</a> - great catalog of watch app demos.<br />
<br />
<a href="http://www.fastcompany.com/3042500/app-economy/how-the-apple-watch-will-work-as-explained-by-the-people-making-the-apps" target="_blank">FastCompany: How the Apple Watch will work...</a> - a couple of thoughts on app design, and screenshots of <b>Todoist</b>.<br />
<br />
<a href="http://elekslabs.com/2015/01/apple-watch-tesla-car-how-far-can-we-drive-them.html" target="_blank">eleks labs' unofficial Tesla app</a> - more design thoughts and prototype video (unofficial development, not affiliated with Tesla)..<br />
<br />
<a href="http://daringfireball.net/2015/02/apple_watch_pricing" target="_blank">Daring Fireball: On the Pricing of the Apple Watch</a> - so yeah, "starting at $349" sounds like it's going to be the understatement of the year.<br />
<br />
<a href="http://www.raywenderlich.com/94672/watchkit-faq">WatchKit FAQ</a> - awesome collection of questions and answers (and cute watch drawings too).<br />
<br />
<a href="http://martiancraft.com/blog/2015/02/briefs-apple-watch/">MartianCraft: Designing for the Apple Watch with Briefs</a> - even if you don't use the tool (which looks great) this is a lovely post on Watch app design.<br />
<br />
<a href="http://www.fiveminutewatchkit.com/">Five Minute Watch Kit</a> - good collection of blog posts.<br />
<br />
If that's got you interested in building apps for the Apple Watch, <i>it's time</i> to check out <a href="http://developer.xamarin.com/guides/ios/watch/">Xamarin's Watch Kit Preview</a> and how to <a href="http://blog.xamarin.com/your-first-watch-kit-app/">get started (inc video)</a> and <a href="http://conceptdev.blogspot.com/2015/01/apple-watch-kit-programming-with-c-and.html">my first watch app</a>.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/J2kgtdCnVoU" width="560"></iframe>
<br />
<br />
I've also got a couple of samples, including <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/Watch8Ball">Magic 8 Ball</a>, <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/WatchCalc">Calculator</a>, <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/WatchInsta">Insta</a>, and <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/WatchTodo">Todo</a> for you to try.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-hwxCgpnN7yw/VOkWBdP1fwI/AAAAAAAAClo/zwrouyLu758/s1600/WatchSamples.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-hwxCgpnN7yw/VOkWBdP1fwI/AAAAAAAAClo/zwrouyLu758/s1600/WatchSamples.png" height="162" width="400" /></a></div>
<span style="font-size: x-small;">^ watch frame screenshots generated with </span><a href="http://infinitapps.com/bezel/" style="font-size: small;">Bezel</a><span style="font-size: x-small;"> thanks to the fine folks at </span><i style="font-size: small;">infinitapps</i><span style="font-size: x-small;">.</span></div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-69178286527385360692015-01-20T07:57:00.000-08:002015-01-20T07:57:11.580-08:00Apple Watch Kit programming with C# (and Xamarin)<div dir="ltr" style="text-align: left;" trbidi="on">
For my "Your First Xamarin.Forms App" talk at Evolve this year I built a very simple version of the classic <a href="https://github.com/conceptdev/xamarin-forms-samples/tree/master/MagicEightBall" target="_blank">"Magic Eight Ball" fortune-telling app</a>. Seemed like a perfect example to adapt for my <i>First Apple Watch App</i>. It's built in C# using Xamarin (of course); <a href="http://developer.xamarin.com/guides/ios/watch/" target="_blank">Xamarin's Watch Kit Preview</a> came out <a href="http://blog.xamarin.com/introducing-the-xamarin-watchkit-preview/" target="_blank">today</a>!<br />
<br />
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". <a href="https://github.com/conceptdev/xamarin-ios-samples/tree/master/Watch8Ball" target="_blank">Grab the code from Github</a>.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-cS8mrOPecQ8/VLq-TOayl9I/AAAAAAAACkE/ILB8WFcQ80A/s1600/8ball-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-cS8mrOPecQ8/VLq-TOayl9I/AAAAAAAACkE/ILB8WFcQ80A/s1600/8ball-1.png" height="320" width="193" /></a> <a href="http://3.bp.blogspot.com/-_cxnhaiGmx0/VLq-TV5S4GI/AAAAAAAACkI/A1hBbKMV-fM/s1600/8ball-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-_cxnhaiGmx0/VLq-TV5S4GI/AAAAAAAACkI/A1hBbKMV-fM/s1600/8ball-2.png" height="320" width="192" /></a></div>
<span style="font-size: x-small;">^ watch frame screenshots generated with <a href="http://infinitapps.com/bezel/">Bezel</a> thanks to the fine folks at <i>infinitapps</i>.</span><br />
<br />
<h3 style="text-align: left;">
Apple Watch Projects</h3>
The <a href="http://staging-docs.xamarin.com/guides/ios/watch/installation/#Project_Structure" target="_blank">solution structure for watch apps</a> consists of three projects (notice that watch apps are split in two parts):<br />
<ul style="text-align: left;">
<li>an <b>iPhone app</b> which delivers the watch app to the user (and is also obviously a regular iPhone app),</li>
<li>an <b>Watch Kit Extension</b> where the <i>code for the watch app runs</i> (on the iPhone, <i>but separate to the iPhone app</i>),</li>
<li>a <b>Watch app</b> which is <i>only the storyboard and image resources</i> that go to the watch itself.</li>
</ul>
<h3 style="text-align: left;">
Storyboard User Interface</h3>
After creating the three projects in a new solution, the first step is to draw the user interface in Interface Builder. Right-click on the <b>Interface.storyboard</b> (already in the template) and open in Xcode.<br />
<br />
I did the following:<br />
<ul style="text-align: left;">
<li>gave the interface controller a <b>Title: 8Ball</b></li>
<li>dragged a <b>Label</b> and centered it</li>
<li><kbd>Ctrl + dragged</kbd> an outlet from the label into the header file called <b>result</b></li>
<li>dragged a <b>Menu</b> onto the scene (this is triggered by Force Touch)</li>
<li>added and named the two <b>MenuItems: Shake & Back</b></li>
<li><kbd>Ctrl + dragged</kbd> an action from the first menu item called <b>shake</b></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-bxVAgAqEgQg/VLrD4y9VyyI/AAAAAAAACkc/Yr96vUkQwaU/s1600/xocde.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-bxVAgAqEgQg/VLrD4y9VyyI/AAAAAAAACkc/Yr96vUkQwaU/s1600/xocde.png" height="172" width="640" /></a></div>
Remember: the storyboard (and any image resources) are the the only things that get installed <i>on the watch itself</i>.<br />
<h3 style="text-align: left;">
WatchKit C# Code</h3>
<div>
With 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 <i>run in the Watch Kit Extension</i> - on the iPhone itself, not on the CPU of the watch.<br />
<br />
First I copied the <a href="https://github.com/conceptdev/xamarin-forms-samples/blob/master/MagicEightBall/Magic8Ball/MagicBallPage.xaml.cs#L17-L40" target="_blank">Magic Eight Ball responses</a> from my Xamarin.Forms app (it's a simple string array, called <code>options</code>) and then I started to implement methods in the <code>InterfaceController</code>.<br />
<br /></div>
<div>
The <code>Awake</code> 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 <code>lastResult</code> and also in <code>NSUserDefaults</code> (for the Glance, explained later).
</div>
<br />
<pre>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");
}</pre>
<br />
Then in <code>WillActivate</code> I set the label's text to the random value:
<br />
<br />
<pre>public override void WillActivate ()
{
result.SetText (lastResult);
}</pre>
<div>
Finally, the menu's <b>Shake</b> button should choose a new random response, so the action is implemented to generate new new answer, set the local <code>lastResult</code> variable, the <code>NSUserDefault</code>, and also the label's text.
</div>
<br />
<pre><code>partial void shake () {
var rnd = new System.Random();
lastResult = options[rnd.Next(0, options.Length - 1)];
result.SetText (lastResult);
NSUserDefaults.StandardUserDefaults.SetString
(lastResult, "lastResult");
}</code></pre>
<br />
That's all the code required to get the app running! I did a couple more things, however, to demonstrate how to <a href="http://developer.xamarin.com/guides/ios/watch/controls/menu" target="_blank">programmatically modify the <b>Menu</b></a>...
<br />
<br />
In the <code>Awake</code> method I add <i>another</i> menu item called <b>Thanks</b>:
<br />
<br />
<pre><code>AddMenuItem (WKMenuItemIcon.Accept, "Thanks", new ObjCRuntime.Selector ("tapped"));</code></pre>
The <code>Selector</code> is implemented as shown - notice the <code>[Export]</code> is required:
<br />
<pre><code>[Export("tapped")]
void MenuItemTapped () {
result.SetText ("You're welcome!");
}</code></pre>
<br />
<h3 style="text-align: left;">
Glance Mode</h3>
I also implemented <a href="http://developer.xamarin.com/guides/ios/watch/glance" target="_blank">Glance mode</a>, which simply displays the last response generated by the app.<br />
<br />
The watch app template already includes a <code>GlanceInterfaceController</code> so I just had to drag a couple of <code>Labels</code> onto it, and <kbd>Ctrl + drag</kbd> an outlet for one, so I could change the text programmatically.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-qMrQufEPiQg/VLrJNP-AknI/AAAAAAAACks/qRJ3Jtvn3zo/s1600/glance.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-qMrQufEPiQg/VLrJNP-AknI/AAAAAAAACks/qRJ3Jtvn3zo/s1600/glance.png" height="180" width="640" /></a></div>
<br />
<br />
Because I always store a generated result in <code>NSUserDefaults</code> the <code>GlanceInterfaceController</code>, the code for the glance is really simple:
<br />
<pre><code>var r = NSUserDefaults.StandardUserDefaults.StringForKey("lastResult");
lastResult.SetText (r);</code></pre>
<br />
<br />
Currently you cannot test Glances from within Xamarin Studio, but it's easy to trigger it using Terminal and the following command (make sure you update path to match your app):<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch --sdkroot=/Applications/Xcode-Beta.app/Contents/Developer/ --device=:v2:runtime=com.apple.CoreSimulator.SimRuntime.iOS-8-2,devicetype=com.apple.CoreSimulator.SimDeviceType.iPhone-6 --launchsimwatch=<b>/Users/craigdunn/Projects/Watch8Ball/Watch8Ball/bin/iPhoneSimulator/Debug/Watch8Ball.app</b> --watchlaunchmode=Glance</span><br />
<div>
<br />
The finished glance display looks like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-LSfDXjcr-64/VLrJeSdkK9I/AAAAAAAACk0/G4oweW2T-fk/s1600/8ball-glance.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-LSfDXjcr-64/VLrJeSdkK9I/AAAAAAAACk0/G4oweW2T-fk/s1600/8ball-glance.png" height="320" width="194" /></a></div>
And that's it! Around 10 lines of C# code to build an <a href="https://developer.apple.com/watchkit/" target="_blank">Apple Watch app</a>.<br />
<br />
Download the <a href="http://developer.xamarin.com/guides/ios/watch/" target="_blank">Xamarin Watch Kit Preview</a>, get the <a href="https://github.com/conceptdev/xamarin-ios-samples/" target="_blank">code from Github</a> and try it for yourself!</div>
</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-42261211639081044312015-01-17T11:05:00.002-08:002015-01-17T11:06:42.682-08:00Microsoft Band: the end<div dir="ltr" style="text-align: left;" trbidi="on">
I had a lot of fun with the Band initially.<br />
<br />
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.<br />
<br />
But that was enough to kill it. The screen went all crazy and illegible. It was dead.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-vkRrRFLyHDw/VLqx3cBOUEI/AAAAAAAACjs/kTUyi4Y9ZSY/s1600/FullSizeRender%2B2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-vkRrRFLyHDw/VLqx3cBOUEI/AAAAAAAACjs/kTUyi4Y9ZSY/s1600/FullSizeRender%2B2.jpg" height="96" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-aNPCqtOb8aI/VLqx3Z98buI/AAAAAAAACjw/SqHjGW82oEE/s1600/FullSizeRender.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-aNPCqtOb8aI/VLqx3Z98buI/AAAAAAAACjw/SqHjGW82oEE/s1600/FullSizeRender.jpg" height="115" width="200" /></a></div>
<br />
<br />
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 <i>hadn't</i> paid for the extended warranty, they would not be replacing it at all.<br />
<br />
Then they asked for another $20. To cover <i>this</i> 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.<br />
<br />
So now I hardly wear it. It's in a drawer somewhere. So long, Microsoft Band, I hardly knew yea...<br />
<br />
Microsoft: if you put a GPS in a <b>fitness device</b>, 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.</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com1tag:blogger.com,1999:blog-6621561.post-49657824745700568722014-11-06T20:55:00.001-08:002014-11-06T20:55:58.395-08:00Microsoft Band (day 7: heart rate)<div dir="ltr" style="text-align: left;" trbidi="on">
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 :-)<br />
<div>
<br /></div>
<div>
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 <a href="http://www.amazon.com/gp/product/B007S088F4/">Polar H7 chest-band</a> paired with both the Polar and Strava apps. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-PKFRRJkSPBw/VFxCAzVQpXI/AAAAAAAACeA/iK2h9SLhmk4/s1600/FullSizeRender_3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-PKFRRJkSPBw/VFxCAzVQpXI/AAAAAAAACeA/iK2h9SLhmk4/s1600/FullSizeRender_3.jpg" height="115" width="200" /></a></div>
<div>
<br /></div>
<div>
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 <i>average of 165 bpm (high of 177</i>).</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-BmzMHbPjwH0/VFxFnwUmZkI/AAAAAAAACeM/dWhRqLzxMHA/s1600/run-hr.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-BmzMHbPjwH0/VFxFnwUmZkI/AAAAAAAACeM/dWhRqLzxMHA/s1600/run-hr.jpg" height="320" width="248" /></a> <a href="http://1.bp.blogspot.com/-RNa57nX-15Q/VFxFn-NkCXI/AAAAAAAACeQ/u2lb9hBWF3Y/s1600/run-minmax.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-RNa57nX-15Q/VFxFn-NkCXI/AAAAAAAACeQ/u2lb9hBWF3Y/s1600/run-minmax.PNG" height="320" width="179" /></a></div>
<div>
<br />
The <b>Polar H7 chest strap</b> data was slightly different though. Here is the graph from the Strava app; it recorded an <i>average of 149 bpm (high 159)</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-NBxRCWXoSGU/VFxGJt4q23I/AAAAAAAACec/DYgSvyGwWzs/s1600/strava-hr.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-NBxRCWXoSGU/VFxGJt4q23I/AAAAAAAACec/DYgSvyGwWzs/s1600/strava-hr.jpg" height="180" width="200" /></a></div>
<br />
And of course you can view the data from the Polar chest-strap in more detail on the Strava website:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-n1P1b86Mzf8/VFxGJilBGxI/AAAAAAAACeg/jrkUZBIglzM/s1600/strava-heartrate.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-n1P1b86Mzf8/VFxGJilBGxI/AAAAAAAACeg/jrkUZBIglzM/s1600/strava-heartrate.png" height="100" width="320" /></a></div>
<br />
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:<br />
<br />
<ul style="text-align: left;">
<li>Microsoft Band reported average 107 bpm (high 147)</li>
<li>Polar H7 chest-strap reported average 81 bpm (high 93)</li>
</ul>
<br />
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?!<br />
<br />
<br />
<h3 style="text-align: left;">
The Bottom Line</h3>
That's all the blog posts for now - my first week with the Microsoft Band is done.<br />
<br />
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 :)<br />
<br />
The negatives are minor, but important for some. The battery <i>realistically </i>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.<br />
<br />
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<i> only</i> fitness-tracking device, purely because the data is locked into the <b>Microsoft Health</b> 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.</div>
</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com3tag:blogger.com,1999:blog-6621561.post-58971876854373797792014-11-05T20:20:00.000-08:002014-11-05T20:21:27.001-08:00Microsoft Band (day 6: data)<div dir="ltr" style="text-align: left;" trbidi="on">
Short update today, answering two questions I've heard a lot about the Band:<br />
<br />
<ul style="text-align: left;">
<li>Can the data be exported?</li>
<li>Does it work for cycling?</li>
</ul>
<br />
<h3 style="text-align: left;">
Can data be exported?</h3>
<div>
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 <b>Connected Apps</b> partners with Microsoft, including <a href="http://runkeeper.com/">RunKeeper</a>, so I signed up for their service to see how much data is shared.</div>
<div>
<br /></div>
<div>
The first problem with <b>Connected Apps</b> 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.</div>
<div>
<br /></div>
<div>
The second 'problem' is that only a summary of each activity is available... here is the information available on <b>RunKeeper</b> after a 5 km run this evening:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-nBRWmeMxANA/VFry7P-ArAI/AAAAAAAACdk/i0xNRKeVWDA/s1600/runkeeper.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-nBRWmeMxANA/VFry7P-ArAI/AAAAAAAACdk/i0xNRKeVWDA/s1600/runkeeper.png" height="202" width="320" /></a></div>
<div>
<br /></div>
<div>
<b>No</b> <b>details</b> 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!</div>
<div>
<br /></div>
<div>
<a href="http://1.bp.blogspot.com/-SWds3w78ft0/VFr2M48fcoI/AAAAAAAACdw/aC9qMeTJoCo/s1600/runkeeper-stats.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://1.bp.blogspot.com/-SWds3w78ft0/VFr2M48fcoI/AAAAAAAACdw/aC9qMeTJoCo/s1600/runkeeper-stats.png" height="94" width="200" /></a>Interesting statistic shown on the RunKeeper website...</div>
<blockquote class="tr_bq" style="background-color: white; color: #444444; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; line-height: 22px; margin: 9px 0px; text-rendering: optimizelegibility;">
1139 RunKeeper users also use this app</blockquote>
<div>
I wonder just how many Bands have been sold so far...</div>
<div>
<br />
<br /></div>
<h3 style="text-align: left;">
Does it work for cycling?</h3>
<div>
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 <i>categorizing</i> 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. </div>
<div>
<br /></div>
<div>
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.</div>
</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com4tag:blogger.com,1999:blog-6621561.post-80160205002236477252014-11-03T21:59:00.000-08:002014-11-04T22:00:13.603-08:00Microsoft Band (day 5: rest)<div dir="ltr" style="text-align: left;" trbidi="on">
No running after the half-marathon, so I thought I would blog some random info about the Band today.<br />
<h3 style="text-align: left;">
Configuring the Run tile</h3>
I mentioned that you can change which stats are displayed while running - to do so click on the <b>Band</b> (top-right of screen) and choose <b>Manage Tiles</b>. This shows the list of available tiles with a 'switch' next to each that lets you show/hide the tile on your Band.<br />
<br />
Some tiles have additional options (indicated by an 'edit pen' icon). Touch the row to configure; in the case of the <b>Run</b> tile it will display a screen explaining the options and an <b>Edit</b> button at the bottom of the screen. The final <b>Run Settings</b> screen lets you click to edit which run statistics are displayed on the Band screen:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-997XqO3il5Q/VFm2__lqQkI/AAAAAAAACcY/Kn0PSaLPCrc/s1600/tiles1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-997XqO3il5Q/VFm2__lqQkI/AAAAAAAACcY/Kn0PSaLPCrc/s1600/tiles1.PNG" height="200" width="111" /></a>
<a href="http://3.bp.blogspot.com/-viaM0XxXKeo/VFm3APjRn-I/AAAAAAAACcg/t1yNj1Z_sWM/s1600/tiles2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-viaM0XxXKeo/VFm3APjRn-I/AAAAAAAACcg/t1yNj1Z_sWM/s1600/tiles2.PNG" height="200" width="111" /></a>
<a href="http://4.bp.blogspot.com/-3lybAQOFYGQ/VFm3AKklFZI/AAAAAAAACcc/cnmNWR9YNXQ/s1600/tiles3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-3lybAQOFYGQ/VFm3AKklFZI/AAAAAAAACcc/cnmNWR9YNXQ/s1600/tiles3.PNG" height="200" width="111" /></a></div>
<h3 style="text-align: left;">
Finding your historical heart-rate data</h3>
I 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 <b>Activity History</b> screen, but that only contains Runs, Workouts, and Sleeps.<br />
<br />
Instead touch the <b>steps</b> 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 <i>scroll down</i> to view past day's step summary... notice the gap in this data (middle screenshot) -- the Band was off my wrist for charging :-)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-DaW3B3frKt0/VFm4nfYLOLI/AAAAAAAACdM/k6BACvIOseE/s1600/steps-main.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-DaW3B3frKt0/VFm4nfYLOLI/AAAAAAAACdM/k6BACvIOseE/s1600/steps-main.PNG" height="200" width="111" /></a>
<a href="http://2.bp.blogspot.com/-2B-9wHhTvcQ/VFm4l4ND3zI/AAAAAAAACc0/eDOqjAg125s/s1600/steps-2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-2B-9wHhTvcQ/VFm4l4ND3zI/AAAAAAAACc0/eDOqjAg125s/s1600/steps-2.PNG" height="200" width="111" /></a>
<a href="http://4.bp.blogspot.com/-xNdsmwhCCuo/VFm4mcyfpnI/AAAAAAAACc8/OwvrF_DooOI/s1600/steps-3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-xNdsmwhCCuo/VFm4mcyfpnI/AAAAAAAACc8/OwvrF_DooOI/s1600/steps-3.PNG" height="200" width="111" /></a>
</div>
<br />
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:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-E8wedCBZDek/VFm4mbItZ4I/AAAAAAAACc4/Me2wj8cN9tM/s1600/steps-4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-E8wedCBZDek/VFm4mbItZ4I/AAAAAAAACc4/Me2wj8cN9tM/s1600/steps-4.PNG" height="320" width="179" /></a>
<a href="http://4.bp.blogspot.com/-lgWHk1dxWYk/VFm4m9AP3eI/AAAAAAAACdE/71ueP7WfEOc/s1600/steps-5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-lgWHk1dxWYk/VFm4m9AP3eI/AAAAAAAACdE/71ueP7WfEOc/s1600/steps-5.PNG" height="320" width="179" /></a></div>
<h3 style="text-align: left;">
Flashlight!</h3>
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...<br />
<br />
If you want total darkness from your Band, enter sleep mode (if you're actually going to sleep) or else turn <b>Watch Mode</b> off so that the screen doesn't even show the time.</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-21819175364748562072014-11-02T12:00:00.000-08:002014-11-04T07:11:40.563-08:00Microsoft Band (day 4: race)<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Today I wore both the <a href="http://www.microsoft.com/Microsoft-Band/en-us">Band</a> and my <a href="http://sites.garmin.com/en-US/forerunner10/">Garmin Forerunner 10</a> in the <a href="http://runsf.com/">US Half-marathon (San Francisco)</a> to compare their usability while running and the data they collect.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-dL9--tSFD5g/VFhg2EN-KJI/AAAAAAAACaY/si-SXLQt-0w/s1600/band-run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-dL9--tSFD5g/VFhg2EN-KJI/AAAAAAAACaY/si-SXLQt-0w/s1600/band-run.jpg" height="108" width="200" /></a></div>
<br />
<br />
<b>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.</b><br />
<br />
<h3 style="text-align: left;">
<b>The Band</b></h3>
I 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.<br />
<br />
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!<br />
<br />
<h3 style="text-align: left;">
<b>The Race</b></h3>
While 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 :-)<br />
<div>
<br /></div>
The 'run tile' display looks like this (apols for the image quality):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-wx28ox_5VB4/VFhjAwkz2VI/AAAAAAAACak/6Fdba17UEVM/s1600/band-display.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-wx28ox_5VB4/VFhjAwkz2VI/AAAAAAAACak/6Fdba17UEVM/s1600/band-display.jpg" height="73" width="200" /></a></div>
<br />
I've configured it via the app <b>Band > Manage Tiles > Run</b> 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 <i>one</i> stat really large, and the double-tap could then cycle between that view and the more crowded setup shown above...<br />
<br />
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.<br />
<br />
I used the Garmin more frequently to gauge my progress since I found its display easier to read on-the-run.<br />
<br />
<h3 style="text-align: left;">
<b>The Results</b></h3>
The 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:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-kTTxEPJxsHs/VFhoA8bYH-I/AAAAAAAACa4/5r_4_GlTNaY/s1600/run-summary.PNG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://1.bp.blogspot.com/-kTTxEPJxsHs/VFhoA8bYH-I/AAAAAAAACa4/5r_4_GlTNaY/s1600/run-summary.PNG" height="320" width="100" /></a></div>
<b>Summary</b><br />
<br />
The 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 <b>Fats</b> and <b>Carbs</b> calorie numbers... nor which is more "correct".<br />
<br />
The Microsoft Health app has the heart rate info: average, high, and low; and also the <b>Recovery Time</b> 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!<br />
<br />
<a href="http://1.bp.blogspot.com/-JS3_FJYDLPw/VFhoAgmHXOI/AAAAAAAACa0/KJuKE3NuXYU/s1600/strava-summary.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-JS3_FJYDLPw/VFhoAgmHXOI/AAAAAAAACa0/KJuKE3NuXYU/s1600/strava-summary.png" height="121" width="320" /></a></div>
<i><br /></i>
<b>Pace</b><br />
<br />
The 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-sEaUMuqn_IA/VFhpwy8ZFbI/AAAAAAAACbI/ds4Cu1KWlGw/s1600/run-pace.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-sEaUMuqn_IA/VFhpwy8ZFbI/AAAAAAAACbI/ds4Cu1KWlGw/s1600/run-pace.PNG" height="200" width="111" /></a>
<a href="http://2.bp.blogspot.com/-J1jIb-oLj7Y/VFhpw_xNbqI/AAAAAAAACbM/rCUW82migC0/s1600/run-hr.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-J1jIb-oLj7Y/VFhpw_xNbqI/AAAAAAAACbM/rCUW82migC0/s1600/run-hr.PNG" height="200" width="111" /></a>
<a href="http://1.bp.blogspot.com/-so-3g0vkyEc/VFhqp9WD26I/AAAAAAAACbg/MVHZpmlRVuU/s1600/strava-elevation.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-so-3g0vkyEc/VFhqp9WD26I/AAAAAAAACbg/MVHZpmlRVuU/s1600/strava-elevation.PNG" height="200" width="111" /></a></div>
<br />
By contrast, the same data in Strava (minus heart rate, which my Garmin watch doesn't record) is much easier to interpret:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-O44Qq1Mq0fg/VFhpw9Kw6jI/AAAAAAAACbQ/4315tfts_qM/s1600/strava-pace.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-O44Qq1Mq0fg/VFhpw9Kw6jI/AAAAAAAACbQ/4315tfts_qM/s1600/strava-pace.png" height="192" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
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 graphs too much :)<br />
<br />
<b>Map</b><br />
<br />
Here's the two maps side-by-side. The GPS accuracy seems fine for both devices - neither had a major error (which does sometimes happen). Microsoft Health has the neat speed-coloring, but again it's hard to see the details inside an app. The Garmin data rendered by Strava is much easier to zoom in and browse around.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-4I0V5M-ISu0/VFhrcw59MrI/AAAAAAAACbs/R_eyI391fbw/s1600/run-map.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-4I0V5M-ISu0/VFhrcw59MrI/AAAAAAAACbs/R_eyI391fbw/s1600/run-map.PNG" height="200" width="111" /></a>
<a href="http://3.bp.blogspot.com/-KnEmEHz7L8g/VFhrcp_GStI/AAAAAAAACbo/gmoMUD5ms0w/s1600/strava-map.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-KnEmEHz7L8g/VFhrcp_GStI/AAAAAAAACbo/gmoMUD5ms0w/s1600/strava-map.png" height="188" width="200" /></a></div>
<br />
<b>Splits</b><br />
<br />
Finally, just for the sake of it, here's the two sets of splits from the Band and the Garmin. Easily close enough to be considered equally accurate over the distance. The nice thing about the Strava presentation (which you can't see here) is how interactive their rendering is: hoving over a split highlights the map and helps you visualize the elevation and location on the course.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-XwwVMgNLLt0/VFhssLXeb7I/AAAAAAAACb8/CS4v0ExfmbU/s1600/run-splits.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-XwwVMgNLLt0/VFhssLXeb7I/AAAAAAAACb8/CS4v0ExfmbU/s1600/run-splits.png" height="320" width="80" /></a>
<a href="http://2.bp.blogspot.com/-k3yPw9mZuFM/VFhssNborqI/AAAAAAAACcA/a8qQKUyw2Hs/s1600/strava-splits.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-k3yPw9mZuFM/VFhssNborqI/AAAAAAAACcA/a8qQKUyw2Hs/s1600/strava-splits.png" height="320" width="227" /></a></div>
<h3 style="text-align: left;">
<b>The Battery</b></h3>
Because I wore the Band <a href="http://conceptdev.blogspot.com/2014/11/microsoft-band-day-3.html">overnight</a> I only had a short time to re-charge it before the race, so it was showing as <b>80%</b> charged when I left for the start line. To really test it, I left the display lit the entire race (although you can press the power button to show and dim it while running). At the end of the race (around 90 mins) the battery indicator looked to be around 50%... it's not very accurate but perhaps some indication of how long the battery could last while running with GPS enabled. The Band worked throughout the rest of the day - receiving notifications and step-counting - finally complaining about <i>low-battery</i> around 8pm... a little over 12 hours of use including the race.<br />
<br />
<h3 style="text-align: left;">
Conclusion</h3>
I still really like the Band (despite <a href="http://conceptdev.blogspot.com/2014/11/microsoft-band-day-2.html">this little problem</a>) and will continue to train with it in addition to my Garmin for a while yet. Some of the non-running functions (like notifications) have been almost as much fun to play with as the running features :)</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com2tag:blogger.com,1999:blog-6621561.post-37568181602861757842014-11-01T19:10:00.000-07:002014-11-03T20:16:48.521-08:00Microsoft Band (day 3: sleep)<div dir="ltr" style="text-align: left;" trbidi="on">
One of the interesting side-effects of how quickly I got used to wearing the Band was that I decided to give the <a href="http://www.microsoft.com/microsoft-band/en-us/support/health-and-exercise/sleep-tracking">sleep monitoring</a> 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 :)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-fGRyvPyEKeE/VFg_jFq5C1I/AAAAAAAACaI/v_M2kgwGhdY/s1600/FullSizeRender%2B(2).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-fGRyvPyEKeE/VFg_jFq5C1I/AAAAAAAACaI/v_M2kgwGhdY/s1600/FullSizeRender%2B(2).jpg" height="137" width="200" /></a></div>
<br />
<br />
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 <i>restful versus light </i>sleep:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-ZlnrwQyJK4s/VFg2ylKf2TI/AAAAAAAACZ0/jjqgvaL1msg/s1600/sleep.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-ZlnrwQyJK4s/VFg2ylKf2TI/AAAAAAAACZ0/jjqgvaL1msg/s1600/sleep.png" height="400" width="170" /></a></div>
<br />
I think I usually fall asleep much quicker than 15 minutes, I guess the Band will answer that question too over time.<br />
<br />
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:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-U7MMUpBNixg/VFg2ycyb5qI/AAAAAAAACZw/3yowRoKj--Q/s1600/sleep-hr.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-U7MMUpBNixg/VFg2ycyb5qI/AAAAAAAACZw/3yowRoKj--Q/s1600/sleep-hr.png" height="173" width="200" /></a></div>
<br />
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.<br />
<br />
To get the battery to 100% takes a <i>lot</i> 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<i> as long as they don't enable GPS</i>. Since I plan to run using GPS tracking daily, will have to wait and see what sort of battery life I get.</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-34507406306843603622014-10-31T12:25:00.000-07:002014-11-03T20:17:18.371-08:00Microsoft Band (day 2: pairing)<div dir="ltr" style="text-align: left;" trbidi="on">
Sadly, day 2 of my Band experience was not as much fun as day 1.<br />
<br />
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.<br />
<br />
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:<br />
<blockquote class="tr_bq">
<b>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.</b></blockquote>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Vx-5ZOlO7WY/VFfhqmV3X6I/AAAAAAAACZA/6PElq2XygGc/s1600/band-error.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-Vx-5ZOlO7WY/VFfhqmV3X6I/AAAAAAAACZA/6PElq2XygGc/s1600/band-error.PNG" height="320" width="179" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
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 <b>My Microsoft Band</b> as they suggested.<br />
<br />
ARGH! Now it sounds like I am going to lose data :-(<br />
<blockquote class="tr_bq">
<b>Unregister Band? Default tile and notification settings will be erased and you will need to factory reset your Microsoft Band.</b></blockquote>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-55fiwckX5bQ/VFfhqmHZIdI/AAAAAAAACZE/x2vMH-wvhTY/s1600/band-unregister.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-55fiwckX5bQ/VFfhqmHZIdI/AAAAAAAACZE/x2vMH-wvhTY/s1600/band-unregister.PNG" height="320" width="179" /></a></div>
<br />
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).<br />
<br />
<b>Worst. User. Experience. Ever.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-HoFMvLUC888/VFfjuRi689I/AAAAAAAACZY/_txt15vzsqk/s1600/help.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-HoFMvLUC888/VFfjuRi689I/AAAAAAAACZY/_txt15vzsqk/s1600/help.PNG" height="320" width="179" /></a> <a href="http://3.bp.blogspot.com/-zP8hxrnxOO8/VFfjufBATaI/AAAAAAAACZc/7yPVpMTwYOc/s1600/no-help.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-zP8hxrnxOO8/VFfjufBATaI/AAAAAAAACZc/7yPVpMTwYOc/s1600/no-help.PNG" height="320" width="179" /></a></div>
<br />
<i>Finally</i> 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-zWeB6ZkBI3c/VFfhqvpYX6I/AAAAAAAACY8/gytTZ1h0EfA/s1600/settings.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-zWeB6ZkBI3c/VFfhqvpYX6I/AAAAAAAACY8/gytTZ1h0EfA/s1600/settings.PNG" height="320" width="179" /></a></div>
<br />
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.<br />
<br />
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.<br />
<br />
I like everything else about it so far though, so I'll keep playing!</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-60462151419930292672014-10-30T22:17:00.000-07:002014-10-30T22:38:30.703-07:00Microsoft Band (day 1)<div dir="ltr" style="text-align: left;" trbidi="on">
I had no clue Microsoft was working on the <a href="http://www.microsoft.com/Microsoft-Band/en-us">Band</a> 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.<br />
<br />
Let me start by saying two things: (1) I really <i>wanted</i> 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.<br />
<br />
<b>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.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-kjY4qA8-kI4/VFMbwVFTgSI/AAAAAAAACYo/ioOFbsszP3E/s1600/FullSizeRender%2B(1).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-kjY4qA8-kI4/VFMbwVFTgSI/AAAAAAAACYo/ioOFbsszP3E/s1600/FullSizeRender%2B(1).jpg" height="200" width="200" /></a></div>
<br />
<h3 style="text-align: left;">
Features</h3>
The initial setup was painless: I downloaded the <a href="https://itunes.apple.com/us/app/id912580285">Microsoft Health app</a> 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.<br />
<br />
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.<br />
<br />
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...<br />
<br />
<h3 style="text-align: left;">
Running</h3>
I was easily able to figure out how to get everything working, but here is the running "<a href="http://www.microsoft.com/microsoft-band/en-us/support/health-and-exercise/running">support page</a>" 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 :)<br />
<br />
To compare the accuracy and usability of the Band I wore my <a href="http://sites.garmin.com/en-US/forerunner10/">Garmin Forerunner 10</a> for comparison. They both took a while to 'find satellites' (and it always <i>feels</i> like forever when you want to start running), but the Band was actually ready slightly ahead of the Garmin.<br />
<br />
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.<br />
<br />
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 <a href="http://www.microsoft.com/microsoft-band/en-us/support">support site</a> 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.<br />
<br />
After the run was over, I uploaded my Garmin data to <a href="http://www.strava.com/">Strava</a> (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.<br />
<br />
<b>Summary Data</b><br />
<br />
Here's the summary info from the Microsoft Health app versus Strava's view of my Garmin-collected data. Both compare pretty well - the <i>Calories</i> calculations are fairly different (something to investigate further) but the distance and pace are pretty close. The best thing about the Band is the inclusion of heart-rate info, without the hassle of a chest-strap or other additional device.<br />
<br />
<a href="http://3.bp.blogspot.com/-ZRIU7ZC8lj4/VFMTnNbuPqI/AAAAAAAACXg/ooLMT3pI374/s1600/band-summary.PNG" imageanchor="1" style="margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-ZRIU7ZC8lj4/VFMTnNbuPqI/AAAAAAAACXg/ooLMT3pI374/s1600/band-summary.PNG" height="320" width="179" /></a>
<a href="http://3.bp.blogspot.com/-6W_5d0W68Qw/VFMTm58os_I/AAAAAAAACXc/tA4zLpsY9Dk/s1600/strava-summary.png" imageanchor="1" style="margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-6W_5d0W68Qw/VFMTm58os_I/AAAAAAAACXc/tA4zLpsY9Dk/s1600/strava-summary.png" height="134" width="320" /></a>
<br />
<br />
The Band also has an interesting '<b>Recovery</b>' estimate (not shown) which I'm still to learn more about.<br />
<br />
<b>Map</b><br />
<br />
Here's the two maps (Band/Health app vs Garmin/Strava). The Band does cute color-coding of pace, I'm not sure whether Strava can do that with more information (it does not have any heart rate data available as the Garmin Forerunner 10 does not support that). The Band track seems a little more accurate, but with a sample size of one it's a little early to draw conclusions about that.<br />
<br />
<a href="http://4.bp.blogspot.com/-R_3Cd_6QoKw/VFMVPNdeEUI/AAAAAAAACX0/uOPUfPAx_Hg/s1600/band-map.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-R_3Cd_6QoKw/VFMVPNdeEUI/AAAAAAAACX0/uOPUfPAx_Hg/s1600/band-map.PNG" height="320" width="179" /></a>
<a href="http://1.bp.blogspot.com/-bbUpZjFBq3k/VFMVOkqqBSI/AAAAAAAACXw/1SCjU1Xaxog/s1600/strava-map.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-bbUpZjFBq3k/VFMVOkqqBSI/AAAAAAAACXw/1SCjU1Xaxog/s1600/strava-map.png" height="320" width="282" /></a>
<br />
<br />
I'm not sure what to make of the Band coloring a 4'20" kilometer as "snails pace" (jk :-)<br />
<br />
<b>Splits</b><br />
<br />
Both provide similar splits data, although the data varies slightly (due to GPS variance).<br />
<br />
<a href="http://1.bp.blogspot.com/-7TLxil0vpew/VFMWLrGIvVI/AAAAAAAACYA/RaHaa5CHv90/s1600/band-splits.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-7TLxil0vpew/VFMWLrGIvVI/AAAAAAAACYA/RaHaa5CHv90/s1600/band-splits.PNG" height="320" width="179" /></a>
<a href="http://1.bp.blogspot.com/-yQ2s9UENVNI/VFMWL4ugoLI/AAAAAAAACYE/4kwdcqSFyvA/s1600/strava-splits.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-yQ2s9UENVNI/VFMWL4ugoLI/AAAAAAAACYE/4kwdcqSFyvA/s1600/strava-splits.png" height="320" width="307" /></a>
<br />
<br />
<b>Graphs</b><br />
<br />
The Microsoft Health app shows pace, heart-rate and elevation. Strava doesn't get heart-rate data but graphs the other two (note the Garmin's GPS error causing a pace calculation error in the Strava graph around the 2km mark).<br />
<br />
<a href="http://4.bp.blogspot.com/-ykwxQqAO6Rg/VFMWmW7ixoI/AAAAAAAACYQ/XkatrlOSqy4/s1600/band-graph.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-ykwxQqAO6Rg/VFMWmW7ixoI/AAAAAAAACYQ/XkatrlOSqy4/s1600/band-graph.PNG" height="320" width="179" /></a>
<a href="http://1.bp.blogspot.com/-wOLy8tzgrx8/VFMWmjIcvRI/AAAAAAAACYU/cWkXQfYFwCA/s1600/strava-graph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-wOLy8tzgrx8/VFMWmjIcvRI/AAAAAAAACYU/cWkXQfYFwCA/s1600/strava-graph.png" height="104" width="320" /></a>
<br />
<br />
Navigating around the map, splits and graphs is fairly easy once you figure it out. Just tap and swipe around until you get the hang of it.<br />
<br />
<h3 style="text-align: left;">
<b>Conclusion</b></h3>
After less than a day it's probably a bit early to draw conclusions, but I overall I had a lot of fun playing with the Band today. Can't wait to race with it and check the data against the watch (and to see heart-rate info for the first time in ages). Here's hoping the number of app integrations increase and they eventually work out sync'ing with Strava!</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com10tag:blogger.com,1999:blog-6621561.post-49659615831767229792014-09-30T15:49:00.000-07:002014-09-30T16:33:54.473-07:00iPhone 6 and 6 Plus LaunchScreen.storyboard for Xamarin<div dir="ltr" style="text-align: left;" trbidi="on">
Following on from the <a href="http://conceptdev.blogspot.com/2014/09/iphone-6-and-6-plus-launch-images-for.html">previous post</a> about adding launch images for iPhone 6 and 6 Plus, here are the instructions for adding a <code>LaunchScreen.storyboard</code> file instead of multiple fixed-size images. Apple's documentation recommends this method over using the static images. I used these instructions for <a href="http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/">replacing launch images with storyboards</a> as a reference.<br />
<br />
Configuring a LaunchScreen like this will automatically <a href="http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions">scale up</a> your app for iPhone 6 and iPhone 6 Plus devices. You might also want to consider adding <b>@3x</b> retina images for iPhone 6 Plus support.<br />
<br />
1. Add a new Storyboard to your project and call it <b>LaunchScreen.storyboard</b>.<br />
<br />
2. Drag a <code>UIViewController</code> in and design your launch screen. I chose a black background with some white centered text - it looks like this (use the <b>VIEW AS</b> option to preview in different sizes):<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-naX_X7wrWSk/VCsuXX4WNaI/AAAAAAAACVs/-SXdQ3YdADQ/s1600/iPhone6Storyboard.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-naX_X7wrWSk/VCsuXX4WNaI/AAAAAAAACVs/-SXdQ3YdADQ/s1600/iPhone6Storyboard.png" height="271" width="400" /></a></div>
3. Open the iPhone application <b>Project Options</b> and scroll down to the <b>iPhone Launch Images</b> section. There is a new <b>Launch Screen</b> dropdown (currently in Beta) that will automatically be populated with the available storyboards and xibs in your project. Choose the storyboard you just added.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-v7wSbYpGcRg/VCsu3z4FUsI/AAAAAAAACV0/2y6c_Y_1WzE/s1600/iOSiPhone6Properties.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-v7wSbYpGcRg/VCsu3z4FUsI/AAAAAAAACV0/2y6c_Y_1WzE/s1600/iOSiPhone6Properties.png" height="220" width="400" /></a></div>
3a. This creates the following key in your <code>Info.plist</code> (just FYI):<br />
<pre><code> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string></code></pre>
<br />
4. 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:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-ymKDdzmXSkw/VCsy2d6vM8I/AAAAAAAACWA/xZBU9twAWRw/s1600/iPhone6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-ymKDdzmXSkw/VCsy2d6vM8I/AAAAAAAACWA/xZBU9twAWRw/s1600/iPhone6.png" height="200" width="121" /></a></div>
<br />
I've updated my <a href="https://github.com/conceptdev/xamarin-forms-samples/tree/master/Todo">Xamarin.Forms Todo sample</a>, the code and <a href="https://github.com/conceptdev/xamarin-forms-samples/blob/master/Todo/Todo.iOS/Resources/LaunchScreen.storyboard">storyboard</a> are available on github.<br />
<br />
<b>UPDATE:</b> <a href="https://twitter.com/gerryhigh/">Gerry</a> <a href="https://twitter.com/gerryhigh/status/517087940116111360">reminded me</a> about <a href="http://www.marco.org/2014/09/17/overcast-accidentally-universal">Marco's experience</a> where adding a <b>LaunchImage.storyboard</b> file causes iOS to ignore the <code>UIDeviceFamily</code> setting in <code>Info.plist</code> (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 :)<br />
<br />
<br />
<br />
<br /></div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com2tag:blogger.com,1999:blog-6621561.post-22847255756280532702014-09-22T13:50:00.004-07:002014-11-04T20:56:33.966-08:00iPhone 6 and 6 Plus Launch Images for Xamarin<div dir="ltr" style="text-align: left;" trbidi="on">
I was initially stumped by how to get my Xamarin.iOS and <a href="http://xamarin.com/forms">Xamarin.Forms</a> apps to size correctly on the iPhone 6 and iPhone 6 Plus. Thanks to this <a href="http://stackoverflow.com/questions/25754942/how-to-enable-native-resolution-for-apps-on-iphone-6-and-6-plus">StackOverflow question & answer</a> I have a solution - reposting here because the solution that works best for me right now is only the 3rd most popular answer there.<br />
<br />
Simply create two new default images (this is for portrait only, but landscape will become obvious later):<br />
<br />
<b>Default-667h@2x.png</b> for <i>iPhone 6</i>; dimensions 750x1334<br />
<br />
<b>Default-736h@3x.png</b> for <i>iPhone 6 Plus</i>; dimensions 1242x2208<br />
<div>
<br /></div>
and place them in the application root or the <i>Resources</i> folder. Notice the filename format is similar to the <b>Default-568h@2x.png</b> image that Apple introduced for the iPhone 5 screen.<br />
<br />
Now edit the source of your <b>Info.plist</b> file (open in a text editor so you can type XML directly) and add the following <a href="https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW28">UILaunchImages</a> key (the first two items are for iPhone 6, the others are for the older default image configuration):<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><key>UILaunchImages</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><array></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageMinimumOSVersion</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>8.0</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageName</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>Default-667h</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageOrientation</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>Portrait</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageSize</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>{375, 667}</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageMinimumOSVersion</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>8.0</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageName</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>Default-736h</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageOrientation</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>Portrait</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageSize</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>{414, 736}</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageMinimumOSVersion</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>7.0</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageName</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>Default-568h</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageOrientation</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>Portrait</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><key>UILaunchImageSize</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><string>{320, 568}</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <key>UILaunchImageMinimumOSVersion</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <string>6.0</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <key>UILaunchImageName</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <string>Default</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <key>UILaunchImageOrientation</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <string>Portrait</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <key>UILaunchImageSize</key></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <string>{320, 480}</string></span><br />
<span style="font-family: Courier New, Courier, monospace;"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </dict></span><br />
<span style="font-family: Courier New, Courier, monospace;"></array></span><br />
<div>
<br />
I've tested this in my <a href="https://github.com/conceptdev/xamarin-forms-samples/blob/master/TodoStyled/Todo.iOS/Info.plist#L35-L67">TodoStyled Xamarin.Forms example on Github</a>.<br />
<br /></div>
<div>
If you wish to support landscape images, add matching keys with <b>Default-Landscape-???h</b> filenames and specify the correct orientation and size.</div>
<div>
<br /></div>
<div>
Note that this is <i>not</i> Apple's <i>preferred</i> way of indicating support for the screen sizes. Their <a href="https://developer.apple.com/library/iOS/documentation/userexperience/conceptual/mobilehig/LaunchImages.html">Launch Images</a> doc says:<br />
<br /></div>
<quote><i> You use a launch XIB or storyboard file to indicate that your app runs on iPhone 6 Plus or iPhone 6.</i></quote>
<br />
<br />
which requires you to create a Storyboard or XIB using <code>size</code> classes. More on how to do that in <a href="http://conceptdev.blogspot.com/2014/09/iphone-6-and-6-plus-launchscreenstorybo.html">this post</a>, or head back to that <a href="http://stackoverflow.com/questions/25754942/how-to-enable-native-resolution-for-apps-on-iphone-6-and-6-plus">StackOverflow post</a>!<br />
<br />
p.s. this <a href="http://www.paintcodeapp.com/news/iphone-6-screens-demystified">iPhone 6 Screens Demystified</a> post by <a href="http://paintcodeapp.com/">PaintCode</a> is awesome!<br />
<br />
<b>UPDATED:</b> <a href="http://twitter.com/jamesmontemagno">@jamesmontemagno</a> informs me that you need to add the original 320x480 into the plist too, so I've added to the example above. </div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com14tag:blogger.com,1999:blog-6621561.post-54255430060400475372013-09-29T19:33:00.001-07:002013-09-29T19:33:47.289-07:00Android TextToSpeech API with Xamarin: it talks too!<p>A recent post covered Apple's new <a href="http://conceptdev.blogspot.com/" target="_blank">text-to-speech API in iOS 7</a>, 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 <code>TextToSpeech.IOnInitListener</code> (which is a single method: <code>OnInit</code>) then create a new <code>TextToSpeech</code> instance:</p>
<pre class="brush:csharp">speaker = new TextToSpeech (this, this);</pre>
<p>and call <code>Speak</code>:</p>
<pre class="brush:csharp">void Speak(string text) {
var p = new Dictionary<string,string> ();
speaker.Speak (text, QueueMode.Flush, p);
}</pre>
<p>The <a href="https://github.com/conceptdev/xamarin-samples/tree/master/TaskyProPortable" target="_blank">TaskyPro</a> sample code has been updated so that <i>both</i> the iOS and Android apps have a <b>Speak</b> button. The Android app looks like this:</p>
<a href="http://4.bp.blogspot.com/-OLLSgOEf0E0/UkjhpJWxDNI/AAAAAAAABxU/IN0aAotJ03Q/s1600/android-tts-1.png" imageanchor="1" ><img border="0" src="http://4.bp.blogspot.com/-OLLSgOEf0E0/UkjhpJWxDNI/AAAAAAAABxU/IN0aAotJ03Q/s320/android-tts-1.png" /></a>
<p>Check out this cool <a href="https://github.com/gregko/TtsSetup_C_sharp" target="_blank">TtsSetup</a> sample for Xamarin (via <a href="http://stackoverflow.com/questions/16779793/how-to-implement-android-callbacks-in-c-sharp-using-async-wait-with-xamarin-or-d" target="_blank">StackOverflow</a>) for more details on how to customize the Android TextToSpeech API.</p>Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-22033375766021783952013-09-27T10:08:00.000-07:002013-09-27T10:08:41.329-07:00Built-in Barcode Scanning with iOS7 and Xamarin: MonkeyScan!<p>Another new iOS 7 feature is built-in support for barcode-scanning via the <code>AVFoundation AVCaptureDevice</code> API. Back in 2012 I threw together <a href="https://github.com/conceptdev/MonkeySpace/tree/master/iOS.MonkeyScan" target="_blank">MonkeyScan</a> using Windows Azure Services and the ZXing barcode scanning library. For iOS 7 I've updated the code to use the <a href="https://components.xamarin.com/view/azure-mobile-services/">Azure Mobile Services Component</a> and the new iOS 7 barcode scanning API instead.</p>
<p>The app looks like this when scanning a PassKit pass:</p>
<a href="http://4.bp.blogspot.com/-V_uNDa0qtLU/UkW3SGfOGfI/AAAAAAAABxE/yC8edEWv5AY/s1600/01_scan.png" imageanchor="1" ><img border="0" src="http://4.bp.blogspot.com/-V_uNDa0qtLU/UkW3SGfOGfI/AAAAAAAABxE/yC8edEWv5AY/s320/01_scan.png" /></a>
<p>The code that sets up an <code>AVCaptureDevice</code> for 'metadata capture' (as opposed to capturing an image or video, I guess :) is shown below:</p>
<pre class="brush:csharp">bool SetupCaptureSession () {
session = new AVCaptureSession();
AVCaptureDevice device =
AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video);
NSError error = null;
AVCaptureDeviceInput input =
AVCaptureDeviceInput.FromDevice(device, out error);
if (input == null)
Console.WriteLine("Error: " + error);
else
session.AddInput(input);
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);
session.StartRunning();
return true;
}</pre>
<p>You can specify specific barcodes to recognize or use <code>output.AvailableMetadataObjectTypes</code> to process all supported types.</p>
<p><b style="color:darkred">...and it speaks!</b><br />
Since the app now requires iOS 7, it can also use the new <code>AVSpeechSynthesizer</code> to speak the scan result as well (see <a href="http://conceptdev.blogspot.com/2013/09/ios-speechsynthesizer-api-with-xamarin.html" target="_blank">previous post</a>).</p>
<pre class="brush:csharp">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!");
}</pre>
<p>The <a href="https://github.com/conceptdev/MonkeySpace/tree/master/iOS.MonkeyScan" target="_blank">MonkeyScan github repo</a> has been updated with this code.</p>Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-64458860842191974712013-09-26T14:49:00.000-07:002013-09-26T14:49:02.751-07:00iOS SpeechSynthesizer API with Xamarin: it talks!<p><a href="http://twitter.com/mikebluestein" target="_blank">Mike</a> posted a neat code example today on <a href="http://blog.xamarin.com/make-your-ios-7-app-speak/" target="_blank">adding the new iOS 7 AVSpeechSynthensizer API to a Xamarin app</a>.</p>
<p>It's so easy, I added speech synthesis to the this <a href="https://github.com/conceptdev/xamarin-samples/tree/master/TaskyStoryboard" target="_blank">TaskBoard to-do list example</a> in about 5 lines of code. Now the app can read the to-do item back to you :) just by adding this code:</p>
<pre class="brush:csharp">if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
SpeakButton.TouchUpInside += (sender, e) => { // requires iOS 7
Speak (TitleText.Text + ". " + NotesText.Text);
};
}</pre>
<p>and</p>
<pre class="brush:csharp">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);
}</pre>
<p>The UI now looks like this: touch the <b>Speak</b> button to hear the text read back to you.</p>
<a href="http://4.bp.blogspot.com/-B61lRuAeGDQ/UkSoxW_9ceI/AAAAAAAABw0/p_EX-I8Z9Fw/s1600/speak2.png" imageanchor="1" target="_blank"><img border="0" src="http://4.bp.blogspot.com/-B61lRuAeGDQ/UkSoxW_9ceI/AAAAAAAABw0/p_EX-I8Z9Fw/s320/speak2.png" title="added a Speak button" /></a>
<p></p>Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0tag:blogger.com,1999:blog-6621561.post-88591397179824866632013-07-10T23:28:00.000-07:002013-07-10T23:28:18.107-07:00New Dropbox API one day, on Xamarin the next<p>Long-time Xamarin customers know that there is a history of <a href="http://blog.xamarin.com/xamarin-releases-same-day-support-for-ios-6/" target="20130710">delivering updates same day</a> when the native platforms (iOS and Android, for example) are upgraded. Today there was another little surprise - the new <a href="https://www.dropbox.com/developers/datastore" target="20130710">Dropbox Datastore API</a> that was announced at <a href="https://www.dropbox.com/dbx" target="20130710">DBX</a> yesterday was made available via a <a href="https://components.xamarin.com/view/dropboxsync" target="20130710">Xamarin Component</a> today!
</p><p>
Think of it as a cross-platform iCloud-like key-value store ~ same kind of stuff you can do with <a href="https://www.parse.com/" target="20130710">Parse</a> or even <a href="http://www.windowsazure.com/">Azure Mobile Services</a>.
</p><p>
Check out the <a href="http://blog.xamarin.com/a-quick-look-at-dropbox%E2%80%99s-new-datastore-api%E2%80%A6-in-c-sharp/" target="20130710">Xamarin Blog</a> for all the details and a cute sample app called MonkeyBox.
</p><p>
<b style="color:darkred">But wait, there's more!</b><br>
In the past I've posted about porting a small "To Do List" application to various different platforms, including <a href="https://github.com/conceptdev/TaskCloud/tree/master/Azure">Azure (iOS, Android, Mac and more)</a> <a href="https://github.com/conceptdev/TaskCloud/tree/master/QuickStartXamarin" target="20130710">twice</a> as well as an <a href="https://github.com/conceptdev/TaskCloud/tree/master/iCloud" target="20130710">iCloud version for iOS</a>.
</p><p>
Here's the same basic code using the new Dropbox Datastore API (just iOS, for now...):
</p><p>
<a href="http://3.bp.blogspot.com/-Qnfoocvs9os/Ud5LITNunlI/AAAAAAAABqw/LuwYwAMvi24/s1600/DropTasky_all.png" imageanchor="1" ><img border="0" src="http://3.bp.blogspot.com/-Qnfoocvs9os/Ud5LITNunlI/AAAAAAAABqw/LuwYwAMvi24/s400/DropTasky_all.png" /></a>
</p><p>
Here's a direct link to the <a href="https://github.com/conceptdev/TaskCloud/tree/master/DropBox" target="20130710">code on github</a>... to use just download the solution (which includes the Xamarin Dropbox Component) and:
</p>
<ol>
<li>Visit the <a href="https://www.dropbox.com/developers/apps" target="20130710">Dropbox App Console</a> to get your access credentials set-up.
</li>
<li>Add the <code>App key</code> and <code>App secret</code> to the <code>AppDelegate.cs</code> in the project.</li>
<li>Add a <b>Custom URL Type</b> to the advanced <code>Info.plist</code> settings (replacing the identifier and also YOUR_APP_KEY with the correct credential value) like this<br /><a href="http://2.bp.blogspot.com/-hj4XVCmjzj0/Ud5NQUS9cXI/AAAAAAAABrA/TkHFtNwNmpc/s1600/Screen+Shot+2013-07-10+at+11.12.51+PM.png" imageanchor="1" ><img border="0" src="http://2.bp.blogspot.com/-hj4XVCmjzj0/Ud5NQUS9cXI/AAAAAAAABrA/TkHFtNwNmpc/s400/Screen+Shot+2013-07-10+at+11.12.51+PM.png" /></a></li>
</ol>
<p>When the app is up-and-running, you can 'browse datastores' from the <a href="https://www.dropbox.com/developers/apps" target="20130710">Dropbox App Console</a> and see the data update on the server in real-time!</p>
<a href="http://4.bp.blogspot.com/-GwfPED3X3K0/Ud5PGVfFqcI/AAAAAAAABrQ/I5RUPXumjWs/s1600/TaskyDrop-website.png" imageanchor="1" ><img border="0" src="http://4.bp.blogspot.com/-GwfPED3X3K0/Ud5PGVfFqcI/AAAAAAAABrQ/I5RUPXumjWs/s400/TaskyDrop-website.png" /></a>
<p>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 :)</p>Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com1tag:blogger.com,1999:blog-6621561.post-48097237224755514892013-01-15T09:49:00.001-08:002013-01-15T09:58:58.585-08:00Xamarin for Java Developers<div dir="ltr" style="text-align: left;" trbidi="on">Last night I was given the opportunity to present <a href="http://xamarin.com/android" target="_blank">Xamarin's Mono for Android</a> to the <a href="http://www.meetup.com/gdgeastbay/events/91538032/" target="_blank">East Bay Google Developer Group</a>. 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 <a href="http://www.slideshare.net/conceptdev/mono-for-android-for-google-devs-16007300" title="Mono for Android... for Google Devs" target="_blank">slides</a> from the talk - please drop me a line with any feedback or questions!
</p><p>
<iframe src="http://www.slideshare.net/slideshow/embed_code/16007300" 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> </iframe>
<p>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):</p>
<p><b style="color:darkred">Learn a new language!</b><br/>
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).
</p><p>
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.
</p><p>
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 <a href="http://xamarin.com/trial" target="_blank">free trial</a> 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.
</p><p>
<b style="color:darkred">Cross-platform development!</b><br/>
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 ;-)
</p><p>
<i>But</i> 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 <i>and</i> 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!
</p><p>
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 <a href="http://xamarin.com/ios" target="_blank">Xamarin's MonoTouch</a> or Windows Phone, Windows 8 and Windows RT tablet apps! You might like C# so much that you do go back and re-write your Java, or at least start building a hybrid that shares some Java and C# code...
</p><p>
<b style="color:darkred">Xamarin does Android well too :)</b><br/>
If Java developers <i>do</i> fall in love with C# then they also find that Xamarin does Android just as well as anyone (probably better!). Our MonoDevelop IDE (and our integration with Visual Studio) means you get an awesome coding experience (autocomplete/intellisense/code completion, debugging, refactoring, source control integration, etc) as well as a drag-and-drop UI designer. You be the judge of whether it's a better experience than Eclipse :)
</p><p>
<b style="color:darkred">Fin</b><br/>
In summary, why not? As a Java developer you have a lot to gain and nothing to lose by giving C# a try. A whole world of new platforms, tools and frameworks become available with a very low barrier to entry. Try it - you just might like it ;-)
</p>
</div>Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com1tag:blogger.com,1999:blog-6621561.post-13119584530597170672013-01-03T12:35:00.002-08:002013-01-03T13:11:33.078-08:00Localizing iOS6 Storyboards with MonoTouch<div dir="ltr" style="text-align: left;" trbidi="on">
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'.<br />
<br />
In iOS6 Apple introduced a new concept - Base Localization - which you can read about in their documentation on <a href="https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/InternationalizeYourApp/InternationalizeYourApp/InternationalizeYourApp.html" target="20130103">Internationalizing Your App</a>. Your project can contain a 'special' <code>Base.lproj</code> directory where the Storyboard files are located, and then a corresponding <code>*.strings</code> file (whose filename matches the Storyboard's) in each language directory with the translations.<br />
<br />
There is a small sample showing how this works with MonoTouch - <a href="https://github.com/conceptdev/xamarin-samples/tree/master/TaskyL10nStoryboard" target="20130103">TaskyL10nStoryboard on github</a>. There is no IDE support currently, but you can easily create the <code>Base.lproj</code> directory manually in MonoDevelop and everything works as expected. Here's a screenshot of the project structure:<br />
<a href="http://4.bp.blogspot.com/-ugz8j2ovcb8/UOXj9hVy91I/AAAAAAAABhY/4E6GXQP4qTs/s1600/Storyboard-l10n-project.png" imageanchor="1" target="20130103"><img border="0" height="320" src="http://4.bp.blogspot.com/-ugz8j2ovcb8/UOXj9hVy91I/AAAAAAAABhY/4E6GXQP4qTs/s320/Storyboard-l10n-project.png" width="268" /></a>
<br />
then inside the Storyboard itself you need to identify the controls you wish to localize. Click on a control to discover its <b>Object ID</b>, and shown in this screenshot:<br />
<a href="http://3.bp.blogspot.com/-ei06N2ndQUg/UOXj-ACHhNI/AAAAAAAABhk/6nNq1Prjmks/s1600/Storyboard-l10n-objectid.png" imageanchor="1" target="20130103"><img border="0" height="340" src="http://3.bp.blogspot.com/-ei06N2ndQUg/UOXj-ACHhNI/AAAAAAAABhk/6nNq1Prjmks/s400/Storyboard-l10n-objectid.png" width="400" /></a>
<br />
Using the <b>Object IDs</b> from the Storyboard file, we can translate the display values for various properties (including text, placeholders and others) in the <code>MainStoryboard.strings</code> file in each language directory, like this:<br />
<pre class="brush:csharp">"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";</pre>
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.<br />
<br />
Here's the localized Storyboard, in Japanese:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-GEHu4Sz7c1c/UOXs0D3IDrI/AAAAAAAABh0/SigzgpF7P90/s1600/L10n.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-GEHu4Sz7c1c/UOXs0D3IDrI/AAAAAAAABh0/SigzgpF7P90/s320/L10n.png" width="213" /></a></div>
<br />
<br />
<b style="color: darkred;">What about layout?</b><br />
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.<br />
<br />
<b style="color: darkred;">What about iOS5 and earlier?</b><br />
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 <code>NSBundle.MainBundle.LocalizedString()</code>.<br />
There is another localized sample - <a href="https://github.com/conceptdev/xamarin-samples/tree/master/TaskyL10n" target="20130103">TaskyL10n</a> - which shows how to localize text elements directly and uses <code>MonoTouch.Dialog</code>.</div>
Craig Dunnhttp://www.blogger.com/profile/09377896535933926653noreply@blogger.com0