(Programmers only): WP7/8 programming for iOS developers – my quick multi-device fix for VS2012 (and an HTC 8S warning)

I've been porting my iOS-based Ubipix location & direction logger app (see THIS) for both Windows Phone 7(.5) and Windows Phone 8. During this, I've discovered a quick and, up to now, undocumented way of speeding up multiplatform development and to avoid having to remove / reinsert cables all the time when selecting which device to deploy the given app to.

This is just a quick note and not a full article  because I think a lot of other are in the same boat as me, wanting to quickly develop for both major WP operating systems and all suffering from the same problem. This is why I've decided to post my hack – I can save a lot of time spent by removing / reinserting cables before. I also want to quickly warn (prospective) purchasers of the HTC 8S of it not having a digital compass, no matter what a lot of reviews and spec sheets state.

(Note that the full, Ubipix-related article will only be later published, along with the explanation of how WP8 enhanced video recording, thoroughly comparing it to how the same is done in iOS. I'll also present you with a full iOS video recorder, with all the sources, fixing all the problems I've listed with the official Ubipix recorder app.)

When developing for iOS (in Xcode), quick, software-only switching is certainly possible. An example showing both my iPhone 5 and an iPad 3 connected to the same Mac and ready to quickly switch between the two:

(click for a larger screenshot!)

The same (quickly switch between two phones to deploy the app to) isn't possible under VS2012 (at least the Express edition – I don't think the paid versions are better in this respect). I've made this screenshot with both a  WP7 and a WP8 phone connected to the same PC:

As you can see, only one device is shown (basically, the one that was connected second) – unlike under Xcode. Unfortunately, (previously) working solutions like the one HERE don't work either – they 1, are only for the previous version (VS2010) and 2, are only for making it possible to run two instances of the emulator in parallel, not from quickly switching between hardware devices.

If you want to develop for WP7, always testing the same code on WP8, your will REALLY want to test your code on as many devices as possible to avoid bad surprises – sudden, unexplainable exceptions etc. For example, it was only after receiving it that I realized that the brand new WP8 phone, the HTC 8S, doesn't have a digital compass – before that, based on the reviews, I had thought it would. (The SlashGear, Geekaphone, TechCrunch articles / spec sheets all state it has a compass. It's only the official spec pages that lack the word “compass”) Whenever instantiating Microsoft.Devices.Sensors.Compass (or even accessing its “IsSupported” class variable), I got an exception with exactly the same code that ran just flawlessly on my LG E-900 (WP7.5, has compass). It was after this that I realized I shouldn't have trusted (p)reviews of the phone because it doesn't have a hardware compass, cotrary to what they state.

What about my hack?

Fortunately, it's really easy to very quickly switch between a WP 7.x and a 8 phone as the current target. Just fire up Task Manager, go to the “Services” tab and find the service “IPOverUsbSvc”. Right-click it and select “Stop” (highlighted below):

Master your iPhone in one minute a day:

Sign up to iPhone Life's Tip of the Day Newsletter and we'll send you a tip each day to save time and get the most out of your iPhone or iPad.

(click for a larger screenshot!)

After this, all deployments will happen on the 7.x WP, not on the WP8 one.

To quickly switch back to deploying to the WP8 phone, just right-click the same  IPOverUsbSvc and select “Start”.

You can always keep Task Manager open, meaning switching between the two platforms is just two clicks away. No more time-consuming cable removals / reinserts!

This all will only work when switching between WP7.x and WP8 devices, not between two WP7.x or two WP8 ones. The hack is based on the fact that the two platforms use entirely different and fully independent ways of communication even when developing:  WP7.x uses Zune, while WP8 uses the IPOverUsbSvc service of the automatically-downloaded “Windows Phone” app. If you disable any of these, the phone using the other (remaining) will be targeted by the next deployment. As killing / restarting Zune is far more time-consuming than doing the same to  IPOverUsbSvc to quickly switch the target phone, I recommend the latter.

I really hope you'll find my quick hack useful and time-saving.

Master your iPhone in one minute a day: Sign up here to get our FREE Tip of the Day delivered right to your inbox.

<p>Werner Ruotsalainen is an iOS and Java programming lecturer who is well-versed in programming, hacking, operating systems, and programming languages. Werner tries to generate unique articles on subjects not widely discussed. Some of his articles are highly technical and are intended for other programmers and coders.</p>
<p>Werner also is interested in photography and videography. He is a frequent contributor to not only mobile and computing publications, but also photo and video forums. He loves swimming, skiing, going to the gym, and using his iPads. English is one of several languages he speaks.</p>