How-To: Show Features Only in Beta Builds

August 12, 2013 1 comment

I was recently asked how to add a “Submit a Bug” feature to an app but only make it visible for Beta builds.


The code to actually send the bug was quite simple:


EmailComposeTask emailComposeTask = new EmailComposeTask();

emailComposeTask.Subject = "My App Feedback";

emailComposeTask.To = "";



Now the question is where to put it. Obviously this could be triggered from a button click, a menu item, or any other control on the screen. But if we only want the item to show up on beta builds we have some extra work to do.

One of the ways I like to deal with this is by adding a new configuration to the Configuration Manager.

In Visual Studio click the Configuration drop-down and choose ‘Configuration Manager’.


In Configuration Manager, choose to create a new configuration.


Call the configuration ‘Beta’ and choose to copy settings from Release.


Click OK to close the dialog.

Make sure ‘Beta’ is selected in the configuration drop-down.

Right click on the project and choose ‘Properties’.


Switch to the ‘Build’ tab.

Add a new conditional compile symbol called BETA.


Close the project properties window and make sure you saved your changes.

Now, anywhere in the code you can use BETA as a conditional compile statement.


#if BETA

contactButton.Visibility = Visibility.Visible;



Now you can easily switch between Debug, Release and Beta builds using the configuration drop-down at the top in Visual Studio!

Categories: Mobile Tags: ,

How Supported Rotations REALLY Work in Windows Store Apps

Apps can specify that they prefer portrait or prefer landscape in their appxmanifest by checking one or more boxes:




However, the app is not guaranteed to get the preferred orientation. The classic example is a game that requests portrait but is being run on a desktop machine with a monitor that cannot be rotated. The game will be forced to run in landscape instead and it’s up to the game to deal with this (e.g. letterboxing or putting content on the sides of the otherwise vertically laid out game).


At //build it was clearly stated that with 8.1 and the smaller 7” devices, most users prefer to hold the device in portrait. Of course in this scenario the device is portable and the OS knows that the device can be rotated, so if an app requests to run in landscape the OS would honor it. But be aware that it’s still possible for an app to get locked in portrait too. It’s less common but can happen. On my old desktop rig I ran dual 27” monitors where one was landscape and the other was portrait. On that machine if I ran store apps on the portrait monitor, the OS would force them to run in portrait.


In summary, you can ask for whatever orientation you want but be prepared not to get it.


For more information see the InitialRotationPreference element.

Categories: Development, Mobile, UX Tags:

Windows 8 Pro vs. Windows 8 RT

July 1, 2013 3 comments

A developer contacted me just after the //build conference asking “I’m a new developer for Windows 8 coming from an iOS development environment.  I was looking to purchase an inexpensive Windows 8 Tablet so I contacted [a vendor] to try to understand their offerings.” Unfortunately the vendor  didn’t do a good job explaining the differences between Windows 8 Pro and Windows 8 RT.  Since I know that’s been confusing from the beginning, I decided to turn my reply to this developer into a blog post that others can share.


There are three main technical differences between Windows 8 Pro and Windows 8 RT:

  1. Windows Pro devices use x86 or x64 CPUs (Intel and AMD) while RT devices use ARM (Qualcomm and NVidia)
  2. Windows Pro devices come with little or no software pre-installed, while RT devices come with Microsoft Office
  3. Windows Pro devices allow applications to be installed from the store and to the desktop, while Windows RT devices only allow store applications to be installed.


So RT devices have very long battery life thanks to ARM, and they can do a lot of the same things Pro laptops can do since they run the same store apps and they come with Office pre-installed. However, since RT devices don’t run x86 and since you can’t install “desktop” apps on them, you can’t install programs like Visual Studio or Photoshop.


The easiest way to summarize:

  • Pro is for laptops and desktops and getting “heavy lifting” done.
  • RT is for “light” work like e-mail, games, browsing, movies, fun.


You can think of RT as a direct competitor to the iPad but with a shockingly large number of features you previously had to buy up to a full laptop to get (Windows, Office, USB, ability to Print, Flash in the browser, Networking, etc.)


I hope that helps

Categories: Mobile Tags:

Build Day 1 Summary

June 26, 2013 Leave a comment

Just wanted to share my notes from day 1 at //build.


Day 1 Keynote

8.1 OS Beta Available

One of the biggest announcements was the preview of Windows 8.1 which you can download at It comes down to your machine as a KB patch that enables the update to show up in the store app on your device. You actually download and install the app through the Store. This is the first time I’m aware of that we’ve distributed an OS-level update through the store.


The update is about 2.1 GB and you can continue using the operating system while the update downloads in the background. Once the download is complete you’ll be prompted to reboot. The machine goes through several phases during the boot screen with the spinning white doughnut. The actual upgrade process takes a good 10 minutes after the download is completed (at least that’s how long it took on my Surface RT).


After the upgrade is complete you will have to go through the out of box experience again, including associating your device with a Microsoft account. But your data is still there and your apps are still installed. There is no way to revert to Windows 8.0, but the installer claims you will be able to upgrade to the final version of 8.1 when it becomes available.


8.1 Platform

The OS received 800 major features and the Windows Runtime received over 5,000 new APIs. These include things like bar code scanning, Bluetooth RFCOMM support and a lot more. I did see a lot of these demonstrated today and they didn’t feel like 5,000 new APIs. I wonder if this number includes the new Bing platform APIs (more below).


Apps appear to be much more tightly integrated. A demo showed going from Bing to Weather to Maps to OpenTable. Another demo showed going from a website with various artists to a playlist in XBOX Music. I’m hoping the session Building Apps that Work Together will provide more information.



Sprint finally has a good lineup of Windows Phones coming. The HTC 8XT looks similar to the 8X on AT&T and Verizon. They also have the ATIV S. With Sprint on board we can now claim all major US carriers have support for Windows Phone.


Bing as a Platform

To me, by far the biggest announcement in the keynote was Bing as a platform. This ‘platform’ is delivered as a set of controls that developers can just plug into their applications. Two of the most powerful demonstrated was the new map control with full 3D support and optical character recognition with language translation.


The map was beautiful and seemed to be even higher quality than the Nokia Here 3D stuff I was raving about a few weeks back. It even apparently supports scripting of the camera location and direction and does smooth animating between points. This was demonstrated with a virtual tour.


The OCR demo showed the user ‘scanning’ a business card in another language with the camera. The text was recognized and each word was framed in a border. Then with a touch, the card was translated into English in real time. Impressive stuff.


Project Spark

They closed with an updated live demo of Project Spark. I just cannot express how excited I am about this platform / game and when I got to play with it at lunch it blew me away. Multi-touch was just as fluid as could be on the 80” PixelSense screen. We created a few different games on the fly and folks from the product team were on hand to answer tons of questions. Of course it’s already been announced that we’re giving the game away for free, but I got confirmation that there will be new characters and add-ons for purchase. When asked if ‘players’ will be able to profit from their creations, the answer was ‘we have nothing to announce on that at this time’. Another attendee asked how it would be possible to import our own custom objects into the game, from, say 3D Studio. His answer was “We have nothing to announce regarding 3rd party partnerships at this time.” Telling, I think. Exciting for sure.


What’s new in the Windows Runtime for Windows 8.1

I was really glad to hear one of the first things they mentioned in this session, which is that they’ve put a bunch of work into improving performance in XAML for 8.1. Not that XAML had terrible performance issues in 8.0, I’m just really glad to see the team continue to invest engineering effort into the XAML UI technology.


A number of new controls were demoed, but probably the most important one is the HubView. We finally have a very prescriptive way of creating the fairly standard “Home” page for many Windows 8 applications.


There’s an update to WebView that allows it to correctly play in screen compositing (previously it only displayed on the top of the Z-Order, so flyouts and things were drawn under it. That’s been fixed. And we now have the ability to put islands of WebGL content in even our XAML apps if we wanted to.


There’s an interesting new option for writing apps that directly support dual screen systems. So, for example, you could have an app where a cashier sees one thing and a customer sees another but it’s all just a single app.


Speaking of Point of Sale, we now have native APIs for barcode readers and mag stripe readers. The mag stripe reader is obviously a sensitive resource. You don’t want another app stealing it away from you when the user is about to swipe their credit card. The device is actually shared across apps, but apps have the ability to capture it and hold onto it during critical times. It’s an interesting API.


There’s a new HttpClient. It looks just like the .Net HttpClient but it’s a WinRT component so it can be used in C++ and WinJS applications now as well.


They demonstrated speech synthesis. The API looks similar to the API on Windows Phone in that you create a synthesizer and tell it to SynthesizeText. What was interesting in the demo is that the text was synthesized to a stream. They then played the stream in a MediaElement but they also said it could be saved to a file or stored in the cloud. One of the things I thought was interesting is that because it’s played through a standard MediaElement it could also be “remoted” via PlayTo.


Finally, they attempted to demonstrate Bluetooth but the demo failed. They were going to control a Sphero robot but they couldn’t get it to pair.


Building an App That Connects to Devices

In this session I was hoping to see a lot of code and demos on connecting to various devices, but it was more of an overview about what’s possible. With 8.1 now supports the following:


· Fingerprint readers

· Barcode readers

· Mag stripe (credit card) readers

· Geofencing (trigger when the user enters or leaves an area)

· Virtual Smart Cards

· 3D Printing

· Image Scanning


In addition to “well-defined” interfaces for known devices, 8.1 also adds support for “custom” devices by supporting industry standard protocols like


· Bluetooth RFCOMM

· Bluetooth Smart / Low Power



· Wi-Fi Direct


This mode of talking to a device is analogous to opening a socket or a serial port and sending bytes. You have to know what packets the device is expecting (i.e. the “shape” of the data) and then you can communicate. They encouraged device developers to wrap protocols into WinRT components so that they’re easier for application developers to consume.


There is also now an official process that hardware manufacturers can go through so that the first time a user plugs in a device, Windows will download and launch the companion application. This is all hooked through the Auto Run infrastructure and the device manufacture has to go through an extra registration process, but it looks pretty cool.


Applications now have a new trigger that they can run on when they’re associated with a device. Applications that run on the custom device trigger can run for up to 10 minutes in the background, allowing for things like data sync or even potentially firmware updates while the app is not in the foreground.


In the end I felt like I would have better benefitted from attending one of the more in-depth sessions like Apps for Bluetooth, HID and USB Devices.


Developing Neural Networks Using Visual Studio

This was the last session I attended and it was mainly out of a curiosity I’ve had for a long time with Artificial Intelligence. The guy was from MS Research and he was pretty entertaining to listen to. He demystified some of the verbiage around the topic and tried to give the audience a kick start, but I still felt you needed to have some basic understanding of the subject matter to benefit from his talk. I was pretty disappointed that the title of his talk included the words “Using Visual Studio” and yet he spent less than 5 minutes running code and didn’t even explain how it worked.




Anyway, so far I’m having a great time and really looking forward to Day 2.

Categories: Cool, Development, Mobile Tags:

Thoughts on PCLs (Portable Class Libraries)

June 4, 2013 1 comment

I’m working with a number of partners right now that want to target both Windows Phone and Windows 8 using a single codebase. This post is a copy of an e-mail I send to them when they’re getting ready to start development using Portable Class Libraries.

First, I’d like to share some libraries that I’ve found to be invaluable during PCL development:


HttpClient for PCL

Windows 8 has the most advanced client for reading data from the web asynchronously. That client is called HttpClient. Unfortunately HttpClient doesn’t exist on Windows Phone, so the moment you check the box to include Windows Phone support in your PCL you lose the ability to leverage HttpClient and have to use the older WebClient. This library adds the awesome tool back into your PCL project.



MVVM Light is one of the most popular libraries for implementing the MVVM pattern on Windows Phone and Windows 8. Until recently they had one library for Windows Phone and another library for Windows 8. This made it impossible to create ViewModels in a PCL project. Now that they have a PCL library you can create all of your ViewModels in PCL and use them on both platforms. The only trick is make sure you reference the PCL version of this library in you Windows Phone and Windows 8 projects as well (not the platform-specific versions).



Finally, are PCLs the right approach for your project? Though I’m a fan of PCLs, I have found there are times when it takes more effort to work around the limitations of PCL than it does to just share (link) code across projects.


For example, let’s say you want to remember a setting between application runs. On Windows Phone you use a class called IsolatedStorageSettings and on Windows 8 you use ApplicationData.Current.LocalSettings. If you wanted to abstract this difference in a PCL you would have to create an interface (let’s call it ISettingManager) and inject that interface from the host application down into the PCL when the application starts up. This is called "Dependency Injection" and you can read more about this approach in Portable Class Libraries: A Primer.


Although dependency injection absolutely will solve this problem, it’s also somewhat complicated to implement. You have to define the interface, create two platform-specific implementations of the interface (one for WP and one for Win8) and then you have to remember to pass the implementation into the PCL on application start. It’s not rocket science, but it is a lot of effort to solve for such a minor difference.


Another approach is to link a .CS file into both projects and take advantage of conditional compile statements. Here’s a short article on conditional compilation in Visual Studio.


With this approach we could easily write the following class and use it in both projects:


static public class SettingManager


    static public void SetValue(string name, string value)


        #if WIN_RT

            var settings = ApplicationData.Current.LocalSettings;

            settings.Values[name] = value;

        #elif WINDOWS_PHONE

            var settings = IsolatedStorageSettings.ApplicationSettings;

            settings[name] = value;




    static public string GetValue(string name)


        #if WIN_RT

            var settings = ApplicationData.Current.LocalSettings;

            return (string)settings.Values[name];

        #elif WINDOWS_PHONE

            var settings = IsolatedStorageSettings.ApplicationSettings;

            return (string)settings[name];





Notice that the compiler takes care of including the right lines of code for each platform. In my opinion this is a lot simpler than creating interfaces and dealing with dependency injection. However, if PCLs make sense for your project using shared files and conditional compilation can be very helpful when creating the interface implementations (wrappers).

Office Hours

February 15, 2013 Leave a comment

I hold weekly Office Hours on Wednesdays from 12pm to 2pm. On the 1st and 3rd Wednesdays of the month I hold them at the Microsoft store in the Galleria mall. On the 2nd and 4th Wednesdays I hold them online.


What are Office Hours?

Simple, it’s a time where I’ll be available for folks who are working on Windows 8 apps to come by and ask questions, show off apps in progress, and in general get help getting their apps in shape for publishing to the Windows Store. I’ll also will be able to help with Windows Phone 8 apps and Windows Azure questions… I just may have to do additional research before I can get you an answer.




Please sign up for a slot via the button above so that I can manage my time more effectively, and let me know if you’re coming to get some questions answered (and a heads-up on the questions will give me some time to do any needed homework) or just to spend some quiet time coding. Feel free to email me at jbienz [at]

Windows 8 App Madness

February 14, 2013 Leave a comment


We’re excited to announce the new Windows 8 App Madness Challenge for Students. With this challenge we hope to excite and motivate thousands of students to build Windows 8 apps over the next 2 months!


· $100/app for up to five Windows 8 apps students publish to the Store.

· Accelerator: 4 sprints during the challenge. The student who publishes the most apps during the sprint wins a trip for 2.

o Facebook poll of students will determine the trip destination. Get voting!

· Timing: From February 12th – April 11th.


Here’s the link to get started:

Categories: Development, Mobile Tags: