Capturing Windows Phone 8 Traffic Using Fiddler

Whenever I need to examine HTTP/HTTPS traffic, I use Fiddler. Fiddler can be a lifesaver when debugging problems, but can also be an extremely useful tool when you want to see what an application sending and receiving.

As I have had some spare time on my hands over the festive break (a rarity these days!!), I wanted to have a look at API calls from some apps on my Windows Phone. Fiddler should fit the bill for this. A few days ago, I upgraded my home machine to run Windows 8.1, so I needed to do a re-install of Fiddler. If you visit http://fiddler2.com/get-fiddler you can download the required build for you operating system. As I have Windows 8.1, I downloaded Fiddler4. Once you have downloaded Fiddler, follow the steps below to set up Fiddler and your phone for traffic capture.

Fiddler Settings

When you have run Fiddler, select the menu option Tools -> Fiddler Options and select the Connections tab. You will see the dialog box that is shown below:

Fiddler Remote Connection
You must now select the checkbox Allow remote computers to connect.

As we want to be able to view HTTPS traffic, we want to be able to decrypt this so we can view it. Click on the HTTPS tab. The tab looks as follows:

HTTPS

Select the checkbox Decrypt HTTPS traffic.

If you haven’t already restart Fiddler. Upon restarting Fiddler, the Windows Firewall warning may pop up.

Windows Phone Settings

We now need to perform some configuration tasks on the phone. Ensure your phone is connected to your WiFi network and perform the following steps.

In order for traffic to be captured by Fiddler, we need to set the WiFi proxy settings for the phones WiFi connection. Long tap on your WiFi connection within the WiFi settings on your phone. An example of this is shown below:

WiFi Settings

Select the edit option. You will then be presented with the following:

Enable Proxy
Swipe On to switch on the proxy functionality.

In the Server/URL setting, type in the IP Address of the computer where you installed Fiddler. You then need to specify the Port number. By default, Fiddler will use 8888. If you have changed this within the Fiddler settings, make sure you use this port number. Click the tick to save your settings.

We now need to download the Fiddler root certificate to the phone. Open Internet Explorer on your phone and key in the URL http://<<server>>:8888/fiddlerroot.cer. <<server>> will be the IP Address of the machine where you installed Fiddler. Using the settings from the example screenshots above, you would use http://192.168.1.78:8888/fiddlerroot.cer. Your phone will then show the following in Internet Explorer:

Fiddler cert
Tap install to install the Fiddler root certificate to your phone.

And that’s it!! As long as Fiddler is running and you have the proxy settings correctly configured on your phone, you should now be able to monitor the HTTP/HTTPS traffic from your Windows Phone.

Remember!

When you have finished monitoring traffic and you have shut down Fiddler, remember to switch of the proxy functionality on your phone. If you don’t do this, you will not be able to use the internet from your WiFi connection, as all traffic will be sent to the proxy, which obviously will not be running.

 

 

 

First Simple App for Windows Phone 8

Having had my Windows Phone for a couple of months now, and having set up a Windows 8 virtual machine to do some app development, I finally decided to sit down and bang out a simple app, to see how easy it is.

To be honest if your skill set follows the form of C#, WPF/Silverlight you won’t have many problems at all. You will need to have Visual Studio 2012 and the Windows Phone 8 SDK installed, but thats a fairly easy (but somewhat lengthy!) process to complete.

As I do a fair amount of driving and tutor Advanced Driving, for my first app I decided to put together a Stopping Distance calculator. I’ve done these for Android and BlackBerry, so thought I would do it for Windows Phone as I have all the calculations to hand.

The idea of the calculator is a simple one. Supply your speed in Miles per Hour or Kilometres per Hour and it will calculate the Braking Distance, Thinking Distance and the overall Stopping Distance (Thinking+Braking). I’ve added a couple of screen shots below of the app running in the emulator. It certainly seems to run fine, and the whole process of developing it from start to finish was about 2 hours. Not bad for a first app.

Screen 1 – Inputs

The inputs into the app are very simple, your speed and from the list, select your unit of measure (MPH or KPH). This is a list picker and will expand when you want to make your selection and then contract when you have made the selection. Simply then tap the Calculate button and you are taken to the results page showing the calculation results.

App Screen 1Screen 2 – Results

The Thinking Distance, Braking Distance and overall Stopping Distance is then displayed with the results in metres and feet. You can then tap another button to take you back to the input screen to allow you to calculate using another speed/unit of measure.

app screen 2

A far from complicated app, but someone going through a driving test, or Advanced driving test does need to know stopping distances. A simple little app that can aid revision of stopping distances.

I think I’ll tidy up the screens, make them a little more visually appealing and then upload to the Windows Phone App Store.

Visual Studio 2012 Error: No exports were found that match the constraint in…

I use a Windows 8 Virtual Machine for any Windows Phone 8 app development I do. I hadn’t fired up my VM for quite a while and there were a whole host of Windows updates to be installed.

After installing the updates and running Visual Studio 2012, I tried to load one of my Windows Phone App solutions. When trying to view any of the pages in Visual Studio, I received the error:

No exports were found that match the constraint:
ContractName
Microsoft.VisualStudio.Project.IProjectServiceAccessor
RequiredTypeIdentity
Microsoft.VisualStudio.Project.IProjectServiceAccessor

Very annoying considering that before the updates were installed everything worked fine. To overcome the issue, what you can do is delete the folder ComponentModelCache, which can be found in this path:

C:\Users\<<user>>\AppData\Local\Microsoft\VisualStudio\11.0\ — where <<user>> is the users folder.

This has worked fine for me and looking at Google, has worked for many other people.

Running Windows Phone 8 Emulator Outside of Visual Studio 2012

Sometimes it is useful to be able to run the Windows Phone 8 emulator without having to create a solution within Visual Studio 2012. Most of the time I am testing apps that I am writing, so launch through Visual Studio, but I have had the need to not do this. After a bit of Googling, the answer became quite clear on how to do this. Never one to keep useful snippets of information to myself, I’ve given the steps below on how to do it.

1. As an administrator, open a command prompt window
2. Navigate to the folder C:\Program Files (x86)\Microsoft XDE\8.0 (CD Program Files (x86)\Microsoft XDE\8.0)
3. Execute the following command: xde -vhd “c:\program files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.vhd”

The emulator should then execute as expected. If you have installed the SDK to a different location, you will need to modify the folders/drive specified above, but if you have a default installation, the above should work fine.

Windows Phone 8 Emulator running in VMWare Player

A couple of evenings ago, I decided to build a Windows 8 64 bit virtual machine with Visual Studio 2012 and the Windows Phone 8 SDK, so I could have a look at writing apps for Windows Phone. The main tool I use for creating and running VM’s is VMWare Player, its free and does exactly what I need. Now, its certainly possible to build a Windows 8 VM through VMWare Player as long as you have Version 5. I downloaded the latest version which is 5.0.2 build-1031769.

I went ahead and built my Windows 8 VM. Installed Visual Studio 2012 which went fine, and then installed Windows Phone 8 SDK. This is where I did have problems, the installation did fail with the usual unfriendly error message we have come to know with some software. After a search on Google, I did find some instructions on how to do this for VMWare Workstation, so thought I would give it a try for VMWare Player, and with a little modification, I’m pleased to say I now have a VM through Player working happily allowing me to test Windows Phone 8 apps through the emulator. I have detailed below exactly what I have done to build the virtual, so if you have had the same problem, following these instructions should sort out your problems.

Make Sure your Host system is good enough

The first thing you need to do is make sure your host system is up to the job. You need to have Hyper V running on your Windows 8 virtual, so your host systems needs to support SLAT – Intel Extended Page Tables. The easiest way to find this out is to use the Coreinfo.exe application. You can download this from the link http://technet.microsoft.com/en-gb/sysinternals/cc835722.aspx. Run a command prompt as administrator and from the directory that has Coreinfo.exe in it, run the command Coreinfo -v. If all goes well, you should see something like the following:

coreinfo

Looking at the last line, if this says Supports Intel extended page tables (SLAT) all is looking good. If SLAT is not supported, don’t continue with this, as I would say it isn’t going to work. Note: The asterisks are important here, if you see a hyphen instead of an asterisk it means the feature is not supported.

Creating the Virtual Machine

Ensure you have VMWare Player V5, as this will allow you to create Windows 8 VM’s. From within VMWare Player, select the option to create a new Virtual Machine, and make sure your dialog looks like the following:

Create VM

Click Next > and for the Guest Operating System select Windows 8 x64. Click Next > and give your VM a machine name. For the disk capacity, keep whats been offered (60 Gb for the disk size). Click Next > again and then click the Customize Hardware button.

For memory select, select 4 Gb if you can, this is what I have used and is what has been recommended in various posts I have read. Hopefully you will be able to allocate this much space. If you can’t select an amount that you can allow, but bare in mind that you should ideally have 4 Gb as a minimum. An example of this is shown below.

VM Memory

The from the list configuration options, select Processors. Select the number of cores you want to allocate, I have selected 2 and then ensure that the option Virtualize Intel VT-x/EPT or AMD-V.RVI is selected. The screen shot below shows my settings.

Processor SettingsClick Finish to save your new VM. Don’t start your VM yet!!!

Editing the VMX File

Before we carry on and start our VM, we need to edit the vmx file that has just been created. Navigate to where you have saved your VM files and look for the vmx file. Mine was called Windows8VM.vmx but yours will be called whatever you have called your VM. Open the vmx file in an editor like Notepad, and add the following line:

hypervisor.cpuid.v0 = “FALSE”

The v0 is a v and a zero.

My vmx file looks as follows. The added line is circled.

vmx file

Save your vmx file. We are now ready to start the VM.

Before you start the VM

Before you start the VM, select it in VMWare Player and edit the virtual machine settings. Select the CD/DVD (IDE) settings and for the Connection, either point this to the ISO for Windows 8 or a physical drive. As I’m installing from an ISO, my setting looked as follows:

CDDVD Settings

Click on OK and then start your VM. The Windows 8 installation should then start. When your Windows 8 installation has finished, you will need to install Visual Studio 2012 and then download and install the Windows Phone 8 SDK. You can get the SDK from this link http://dev.windowsphone.com/en-us/downloadsdk.

Conclusion

The above worked for me fine. It’s a mixture of installing for VMWare workstation and a bit of bespoking for VMWare Player through trial and error, hopefully this will work for you too and get you on the road to using the Windows Phone 8 emulator for testing your apps.

Nokia Lumia 520

Nokia Lumia 520 BlueI’ve had a mobile phone since the early 90’s when they were the size of a house brick. Over the years have replaced these with relatively useable phones. When work started to supply me with mobiles, I never really had a need to then replace my own phone. I’ve always had BlackBerry’s supplied to me and its never been that great an experience, but then, I don’t use Facebook or Twitter, etc on the phone.

Mid last year I decided to get myself a cheap “smart-phone” to play around with and to also enable me to switch the work phone off outside of work hours. This was a cheap Android phone which served my needs up until Christmas. For Christmas my wife bought me a Google Nexus 7 tablet which is a cracking bit of kit. I started to use this for all sorts of things, including Facebook and Twitter (before the tablet I used the good old PC!). I’m not a big Facebook user, so only give this a quick look maybe once a day, but I am quite a big user of Twitter and more recently Instagram. Whilst the tablet was great for this, it didn’t enable me to grab pictures or tweet anything on the go. The Android phone I had was slow and the camera, etc was not of great quality. Time for a new phone!!

My wife has a Samsung Galaxy S3 which is a brilliant phone, but I didn’t want to go for a contract that was going to cost the earth per month, so things like the S3, etc were out of the window. I also wanted to just be a little different and try something that the majority won’t, Windows Phone 8. Looking around I found the Nokia Lumia 520, which had some great reviews, so for a contract of £7.50 per month, I ordered one up.

Whats the Lumia 520 Like?

I have to say I’m impressed with this phone, I’ve been using it for a month now and have had no problems with it. Its light, responsive and feels like a quality phone. The screen size is 4 inches which is more than enough for my needs, picture quality is fine as well. I can’t comment on anything to do with music, as this is a side of the phone I will not be using. One gripe I do have is that the screen can get full of finger prints pretty quickly compared to say the S3 or even my cheap old Android, but a quick clean soon sorts this out.

The camera is also good. At 5MP the quality won’t blow you away, but its fine for capturing that priceless family moment. Battery life is ok, I wouldn’t mind a little bit longer, but then I do use it quite a bit. A charge over night sorts this out, and I certainly don’t want to be using the phone overnight!

In all, I’m pleased with the phone, it looks nice and feels like a quality phone.

Windows 8 Phone

So now we move on to Windows Phone 8, do I like it, is it any good? Well, the first thing to say is, it looks nice! That in itself isn’t a reason to use it, but I have to say, I do like it. Its a big departure from Android, but it has an intuitive interface and its easy to find your way around. As with everything Microsoft, you do need to have a Microsoft account (formerly a Live ID), I’ve had this for ages now, so upon switching on the phone, I entered my credentials and away I went. Well, not quite away I went. I generally have mobile data disabled on my phone and switch it on as and when I need it, so I did have to connect up to my router, but thats easy.

As I’ve already mentioned, I am a Facebook, Twitter and Instagram user, so my first port of call was to download the Twitter and Facebook apps. The Twitter app is not vastly different to the Android offering, so I felt at home. The Facebook app, whilst it works, isn’t particularly nice experience (nor is the Android one to be honest!), but it does its job.

Integration with SkyDrive is tight. Before having this phone, I was a SkyDrive user, so its nice that the integration is there (well you would expect it to be!!!). You can configure the camera app to automatically save pictures to your SkyDrive so there is no risk losing them from your phone. Obviously you will need a data connection to be able to do this (and it would soon eat into your allowance should you not be using WiFi), but its a very simple exercise to upload them to SkyDrive later on when you can use WiFi.

No Instagram?

Thats right, there isn’t an official Instagram app for Windows Phone 8, but there are some third party apps that will do the job. After a quick search around and a comparison between the offerings, I settled on the Instance app. There is a free and paid for version, I’ve gone for the free version, which shows a small advert at the bottom of the UI, which I can live with. It does everything I want and will fill the gap until an official Instagram app is released (maybe one day!!).

Managing Contacts

Managing contacts is a breeze using the People app. It allows you to integrate with Hotmail, Facebook, Twitter and LinkedIn, etc, and will import your contacts should you wish. I have imported my Facebook and Twitter contacts (as well as my contacts from my previous phone) and this is where I spend most of my time. Through the People app, I can look at all posts on Twitter and Facebook and allows you to tweet or post to a contacts Facebook wall, nice and easy. You could do away with Facebook and Twitter and just use People should you want to. I have removed the Facebook app and check all of this through People, but I have kept Twitter installed.

Live Tiles

Apart from looking nice, these are very useful. For example, from People, I have pinned my wife to my start screen, so I can pull up her details, call, text or contact her in any way available simply by using her tile. As the tile is live, it does also display any tweets, Facebook posts, etc she has last made, very useful. Integration to your email is very simple and again with a live tile, I get info on emails that have come in at a glance, very useful.

Was it worth it?

I have to say that I am very pleased with the phone and the operating system. Whilst I do like Windows Phone 8, it doesn’t do anything you can’t do with Android and I dare say the Apple offering (I’ve never used that so wouldn’t know). I am far from a power user of smartphones, and the phone and more importantly operating system does everything I need and I really do like the look and feel of it.

If you wanted to take the plunge and try something different like Windows Phone 8, I would recommend checking out the app store to ensure that everything is available that you currently use. For me pretty much everything is (come on Instagram!!!) from news apps to the social networking tools.

In all, very pleased with my purchase and its nice to be a little different sometimes!!