PhoneGap for Windows Phone

 

If you are writing your phone applications using HTML5, you will want to check this out. PhoneGap has released an update to work with Windows Phone.  What PhoneGap does is allow you to write your phone application in HTML5 and still access most of the Native API’s and wrap it in a Native application wrapper so that you can put it in the marketplace.  This means you can write your application cross platform.

You can download it from here : http://phonegap.com/  or just watch the video below for more information.

The Web Role was started in a wrong port

imageOne of the great things about Windows Phone is all of the samples that are out there.  And topping them all is the Windows Azure Toolkit for Windows Phone 7 .  The toolkit gives you everything you need to develop a Windows Phone application using Windows Azure. I will do a full post walkthrough of using the toolkit, but I thought I would post about one thing that seems to be tripping people up when they are trying to get things up and running.

If you start the project and get the error Sorry, an error occurred while processing your request, the web role was started in a wrong port, You might scratch your head.  If you peek at the url you will notice that it is running on port 444 instead of 443

image

The reason it is doing this is because if it does not find port 443 open, it will increment by one until it finds an open port. If you look in your compute emulator you will also see the wrong port. Which is the reason it says The web role was started in a wrong port.  Because it was :)

image

So now, to fix this you want to see what is running on port 443.  To do this open a cmd window and type in the following netstat –aon

This will bring up a list of what is running on each port.

image

You want to look for anything that has a :443 at the end of it and look at the last column.  This is the process ID for the process that is using that port.

Next, open up Task Manager and look for the process ids that you found. ( You may need to go to View –> Select Columns first to add the PID column)

 

image

My offending applications were:

  • SQL Reporting Services (Which I shut down in Services)
  • TweetDeck
  • Skype

That fixed it for me… hope that helps

Daniel

Windows Phone App of the Day–LilDemonsSpplatter

Those that know me, know that I am not really a gamer.  I enjoy a game once in a while but usually don’t spend much time playing them.  I came across this FREE  game today that is really cool.  It’s a first person shooter game for the phone.  The graphics could be a bit better but hey… Its free.  Check it out.  http://www.windowsphone.com/en-US/search?q=LilDemonsSplatter 

Nokia Developer Program

In addition to the launch of the Phones from Nokia is the launch of the Nokia Developers Program.  The program includes Tools, Documentation, Code Examples, Videos and a vibrant community to get you on your way.  Head over to the developer site http://Developer.Nokia.com/WindowsPhones  or go directly to the code samples to check them out. http://www.developer.nokia.com/Develop/Windows_Phone/Code_examples/

Examples are a great way to jumpstart the development on that app you have been thinking about.

 

This work is licensed under a Creative Commons license.

Free Windows Phone Workshops

Starting Next week, I will be doing a series of Windows Phone Workshops online to teach people how to program with Windows Phone.  You can find the current workshops available by either clicking on the Upcoming Workshops link above or by clicking here : http://thesociablegeek.com/event-registration/

In these workshops I plan to talk about one subject matter at at time. I will be LiveStreaming from beautiful LA so you can follow along from wherever you are in the world.  I am completely open to suggestions, so feel free to join in the chat and suggest something OR email me daniel.egan AT microsoft DOT com.  Since this is new, there may be some bumps along the road while I get the technology sorted out.   I hope you enjoy the upcoming events.  Please Register for the events so I know how many people to expect.

Daniel – The Sociable Geek

This work is licensed under a Creative Commons license.

Windows Phone App of the Day : FourSquare

Foursquare has been around since the release of Windows Phone but they have made some cool new improvements lately.  They are utilizing the deep linking of the new secondary live tiles to pin specific places to your home screen.  If you would like to see how to do this in your own application, you can check out my post on the subject here http://thesociablegeek.com/2011/11/09/live-tiles-in-wp-mango/

Why is this cool?  Well, if you are a FourSquare addict, then you can save yourself some time by pinning the place you go to the most onto your homescreen.   1 Click will Deep link you into that specific check in.

 

Besides my post (above), if you want more info on working with live tiles, check out the following :

Jeff Blankenburg has also created a post on Live tiles for his 31Days of Mango Series : http://www.jeffblankenburg.com/2011/11/11/31-days-of-mango-day-11-live-tiles

Or the Jump Start Video on Channel 9

http://channel9.msdn.com/Series/Mango-Jump-Start/Mango-Jump-Start-10-Tiles–Notifications-on-Windows-Phone

This work is licensed under a Creative Commons license.

Windows Phone, The Xbox of today

 

For anyone that has seen me speak in the last year and a half, they know my answer to “Why Windows Phone”.  To me, it is really a simple question and I always give the same answer.  The first thing I say is bottom line, it is a Great Phone.  I have met and talked to thousands of consumers and developers and anyone that has had it in their hands for any amount of time cannot come away from the experience without likening it.  It is a very well designed phone, that is powerful, easy to use, with some very unique attributes that other phones don’t have.  Another thing you will notice if you have seen me in person, is that I don’t get into a us vs. them argument.  To me, it is not about that.  To me, (to quote one of my favorite movies) if you build it (a great product), they will come. (Period).

The next thing I usually compare it to is the Xbox. A gaming system that has come a long way and is now a force to be reckoned with.  I was reminded of this recently by a story put out by Games Beat about the 10th anniversary of Xbox titled:

The making of the Xbox: Microsoft’s journey to the next generation

It is not a short post, and as a matter of fact, the link above is to the second part of the story (which itself is 7 pages long).  It details out how Xbox was lucky to get out the door to begin with but has risen to be, for the last 12 months, the fastest selling console in the US.  The Kinect sensor has really supercharged the industry and beyond. We are just starting to see what people are doing with the Kinect sensor by itself. I see this exploding in coming years.  As part of this, make sure you read Brandon Watson’s Post on Windows Phone Dev Ecosystem – One Year on.

So I see the Windows Phone in the same way. A great product with a great future.  If you disagree, let me know why.

This work is licensed under a Creative Commons license.

The making of the Nokia Lumia 800

As a developer, and I mean as someone who gets his hands dirty in the code that is NEVER SEEN by whomever uses my software, I am always facinated by the design process that goes into making things “Look Good”.  In this short video, you can see how Nokia went about designing their new Nokia Lumia 800 phone which runs the Windows Phone OS codenamed Mango.   Let me know what you think.

 

This work is licensed under a Creative Commons license.

Work on the Windows Phone Team

The jobs keep coming.  This is a great time to be a part of Windows Phone,  as you can see by my recent posts, there are a ton of great jobs out there for great people… Well here is one more.

 

Brandon Watson who runs Developer Experience for Windows Phone has a position on his team.   You can read his clever way of posting it here http://www.manyniches.com/windows-phone/windows-phone-is-hiring-on-my-team/  (Its all in Tweets)

 

Or you can look for the official position description here.

Either way, I can attest, it is a cool way to spend your day…. So send in your resume and join the team.

This work is licensed under a Creative Commons license.

Live Tiles in WP Mango

Ever since Windows Phone came out, I have always contended that Live tiles are the coolest feature and one that is :

1) Not on any other platform (Yes, I know that Android has widgets… not the same thing)

2) A great way to drive people into your application. (Which you want if it is add based.)

 

I will do another post later about why you should do Live Tiles from a Monetizing standpoint, but for this post, I just want to show you how easy it is to work with live tiles.

 

To begin with, live tiles have been around since 7.0 but to really take advantage of them you had to use Push Notifications.  While this is not THAT difficult, it did add quite a bit of complexity and the need to host your own service (or use scheduled tiles).  In the Mango release, we have made 4 great additions to live tiles.

 

1) You can change the live tiles from your code.

2) You can create secondary tiles to deep link into specific pages of your application

3) You can write on the back of tiles and have them flip

4) You can use background process to have them change when not even in your application

 

To create and modify live tile is fairly simple.

This firs thing we want to do is create a simple windows phone page that has three buttons on it:

  • Create App Tile
  • Create Second Tile
  • Delete Secondary Tile

Next we need to go to code behind and add a using statement for the phone shell.

 

using Microsoft.Phone.Shell;

Then inside the first button click we add the following code :

 

 private void button1_Click(object sender, RoutedEventArgs e)
        {

            //Tile is always the first Tile, even if not pinned .
            ShellTile TileToFind = ShellTile.ActiveTiles.First();

            if (TileToFind != null)
            { 

                StandardTileData NewTileData = new StandardTileData();

                NewTileData.Title = "My Cool Tile";
                NewTileData.BackgroundImage = new Uri(
                    "CoolTile.jpg", UriKind.Relative);
                NewTileData.Count = 5;

                NewTileData.BackTitle = "Tiles Got Back";
                NewTileData.BackBackgroundImage = new Uri(
                    "CoolTileBack.jpg", UriKind.Relative);

                TileToFind.Update(NewTileData);

            }

        }
  • The first thing we do is get a reference to the Live Tile that comes with your application. (TileToFind)
  • Once we have a reference to it we can create our new tile data using the StandardTileData class.
  • We set the properties including the image we want on the live tile (a 173 by 173 png or jpg… make sure that your image is set to “content” in your project or you will not see it)
  • Next we set the back of the tile
  • And finally call the update method to change the live tile.

 

That is all you need to do to change your live tile.

If you want to create a secondary tile, it is slightly different.

 

for the second button click event we do the following

private void button2_Click(object sender, RoutedEventArgs e)
        {
            ShellTile SecondTile = ShellTile.ActiveTiles.FirstOrDefault(
                x => x.NavigationUri.ToString().Contains("Page2.xaml"));

            StandardTileData NewTileData;
            NewTileData = new StandardTileData();

            NewTileData.Title = "Secondary Tile";
            NewTileData.BackgroundImage = new Uri(
                "CoolTile.jpg", UriKind.Relative);
            NewTileData.Count = 5;
            NewTileData.BackTitle = "Second Tiles Got Back";
            NewTileData.BackBackgroundImage = new Uri(
                "CoolTileBack.jpg", UriKind.Relative);

            if (SecondTile == null)
            {
                ShellTile.Create(new Uri(
                    "/Page2.xaml", UriKind.Relative), NewTileData);
            }
            else
            {
                SecondTile.Update(NewTileData);
            }
        }

 

There are a couple of noticeable change.  To find the secondary tile, we need to search for it since we are not guaranteed that it exists.  We do this by searching the ActiveTiles collection for the NavigationUri of the tile that we set lower in the event.  The only other change is creating the tile if it does not exist.  Otherwise we update it like before.

I have included all the code for the project HERE

If you want to run this code in the background so you can change the tile while users are not using the phone. You can check out my post on Background Agents

 

Enjoy

This work is licensed under a Creative Commons license.