Advertisements
//
archives

Windows Phone

This category contains 10 posts

Amazon SimpleDB for Windows Phone Part 4 — TVMClient

Today I was made aware that in my series on Amazon SimpleDB for Windows Phone, I had mentioned that part 4 would contain some code samples and talk about encryption. I was confused for a second because I knew there was no part 4 and I thought the series was done. The series is not done. This is part 4 where we’ll show how to decrypt the credentials sent from the TVM. This one goes out to reader @jayborseth.

One thing to note is that since I started the series, an AWS SDK for Windows Phone has been released in beta form. The example I’m about to show does not use this SDK (and I don’t think the SDK has any work with the TVM).

As a refresher, the Token Vending Machine allows for an application to obtain temporary credentials for access to AWS services. In the anonymous way of obtaining credentials, there are 3 steps:

 

Step 1 – Register Device

Here is my code to register the device:

public void RegisterDevice(string deviceId, string tvmKey, Action callback)
{
    IDictionary parameters = new Dictionary();

    parameters["uid"] = deviceId;
    parameters["key"] = tvmKey;

    string queryString = GetParametersAsString(parameters);

    var uri = new Uri(string.Format("{0}/registerdevice?{1}", TvmUrl, queryString));

    var hwr = WebRequest.Create(uri) as HttpWebRequest;
    if (hwr != null)
    {
        hwr.Method = "GET";
    }

    TemporaryTokenPackage tokenPackage = new TemporaryTokenPackage() { DeviceId = deviceId, Request = hwr };

    AsyncCallback responseHandler = (async) =>
    {
        TemporaryTokenPackage temporaryTokenPackage = (TemporaryTokenPackage)async.AsyncState;
        HttpWebRequest request = temporaryTokenPackage.Request;

        HttpWebResponse response = null;
        try
        {
            response = (HttpWebResponse)request.EndGetResponse(async);
            callback(true, null);

        }
        catch (WebException we)
        {
            if (((HttpWebResponse)we.Response).StatusDescription == "Conflict")
            {
                callback(true, null);
            }
            else
            {
                callback(false, we);
            }

        }
    };

    hwr.BeginGetResponse(responseHandler, tokenPackage);
}

Couple of things. Here is my TemporaryTokenPackage which I used to pass pieces of data around the async handlers:

public class TemporaryTokenPackage
{
    public HttpWebRequest Request { get; set; }
    public string DeviceId { get; set; }
}

In the RegisterDevice method, we setup a typical request having a device ID and a tvm key. The tvm key is a Guid string without dashes. So,

tvmKey = Guid.NewGuid().ToString().Replace(“-“, “”);

You set the key and tell the TVM what key you are going to use using this call. The TVM will eventually use that key to encrypt the credentials.

The /registerdevice HTTP call doesn’t do much. If it returns, then you’ve successfully registered the device. If you get any error, you did not register the device and something is wrong. Try again.

Step 2 – Ask for Temporary Credentials

This is the part of the process where you ask the TVM for temporary credentials. If you already have a set of temporary credentials and they haven’t expired, you don’t need to ask for another set. Otherwise, get out your knee pads and beg. Here is how I did it:

public void GetTemporaryCredentials(string deviceId, string tvmKey, Action callback)
{
    string timeStamp = GetFormattedTimestampIso8601(0);
    string signature = Hmac2556Sign(timeStamp, tvmKey);

    IDictionary parameters = new Dictionary();
    parameters["uid"] = deviceId;
    parameters["timestamp"] = timeStamp;
    parameters["signature"] = signature;

    string queryString = GetParametersAsString(parameters);
    var uri = new Uri(string.Format("{0}/gettoken?{1}", TvmUrl, queryString));

    var hwr = WebRequest.Create(uri) as HttpWebRequest;
    AsyncCallback responseHandler = async =>
    {
        var request = (HttpWebRequest)async.AsyncState;

        HttpWebResponse response = null;
        try
        {
            response = (HttpWebResponse) request.EndGetResponse(async);

        }
        catch (WebException we)
        {
            callback(null, we);
        }

        if (IsGoodResponse(response))
        {
            Stream stream = response.GetResponseStream();
            var sr = new StreamReader(stream);

            var responseText = sr.ReadToEnd();
            sr.Close();

            var dataToDecrypt = Convert.FromBase64String(responseText);
            var plainText = Decrypt(dataToDecrypt, tvmKey);

            var temporaryCredentials = AwsTemporaryCredentialFactory.Create(plainText);

            callback(temporaryCredentials, null);

            return;

        }
        else
        {
            string responseText = "noresponse";

            if (response != null)
            {
                responseText = response.StatusCode.ToString();
            }

            callback(null, new WebException("Bad web response, StatusCode=" + responseText));

        }
    };

    hwr.BeginGetResponse(responseHandler, hwr);
}

Step 3 – Decrypt Your New Creds

This is where, as they say on MTV Cribs, the magic happens. Note that at the start of this method, we’re calculating the signature. This is what we talked about in Part 1. The bulk of this method is setting up the async HTTP call and dealing with the response. If we have a good HTTP response, we know that the TVM sent us something secret and we need to get it out. After encrypting the temporary credentials, the TVM will Base64 encode the result. So we need to decode that data using the .NET framework methods and we simply call Convert.FromBase64String which gives us a lovely byte array. Oh byte array.

This byte array is the raw encrypted credentials and we need to decrypt it. I pass into the Decrypt method the binary data to decrypt and the same tvm key that we used to register the device. Here’s the Decrypt method:

public string Decrypt(byte[] dataToDecrypt, string secretKey)
{
    var secretKeyToUse = DecodeHex(secretKey.ToCharArray());
    var cipher = CipherUtilities.GetCipher("AES/CBC/PKCS7Padding");

    cipher.Init(false, new KeyParameter(secretKeyToUse));

    int size =  cipher.GetOutputSize(dataToDecrypt.Length);
    var results = new byte[size];

    int olen = cipher.ProcessBytes(dataToDecrypt, 0, dataToDecrypt.Length, results, 0);
    cipher.DoFinal(results, olen);

    var result = Encoding.UTF8.GetString(results, 0, results.Length);

    return result;
}

///
<summary> /// Used to decode a plain text key into a key that can be used to decrypt. The data being passed in is assumed to be a
/// series of hex digits and this converts those 2-digit hex bytes into a single byte array.
/// </summary>
/// This is adapated from the org.apache.commons.codec.binary.Hex java source code at http://kickjava.com/src/org/apache/commons/codec/binary/Hex.java.htm
///
///An array of characters containing hex digits
/// A byte array containing the decoded hex data in binary format.
public static byte[] DecodeHex(char[] data)
{
    int len = data.Length;

    if ((len & 0x01) != 0)
    {
        throw new DataLengthException("Odd number of characters.");
    }

    var outresult = new byte[len >> 1];

    // two characters form the hex value.
    for (int i = 0, j = 0; j < len; i++)
    {
        var f = Convert.ToInt32(data[j++].ToString(), 16) << 4;
        f = f | Convert.ToInt32(data[j++].ToString(), 16);

        outresult[i] = (byte)(f & 0xFF);
    }

    return outresult;
}

Unfortunately, the key as we have it in memory is not what the TVM used to encrypt with. We need the DecodeHex method to rearrange the bits until we get a key that is the same format as was used to encrypt. Using this decoded key, we’re using the Bouncy Castle CipherUtilities to do the actual decryption. Assuming this works, we’ll end up with a UTF8 encoded string of decrypted data. But wait! There’s more!

Just having this string doesn’t give us everything. We need to split this packed string into a useable set of credentials. I used a factory to unpack this string into its constituent pieces of data (note that this is nearly identical to how the Andoid SDK sample did it):

public class AwsTemporaryCredentialFactory
{
    private const string AccessKeyName = "accessKey";
    private const string SecretKeyName = "secretKey";
    private const string SecurityTokenKeyName = "securityToken";
    private const string ExpirationDateKeyName = "expirationDate";

    ///
<summary> /// Used to create a set of temporary security credentials from the response provided by the
 /// Token Vending Machine.
 /// </summary>
    ///The response from the Token Vending Machine
    /// A set of temporary AWS credentials
    public static AwsTemporaryCredentials Create(string credentialString)
    {
        AwsTemporaryCredentials credentials = new AwsTemporaryCredentials
                                                  {
                                                      AccessKey = ExtractElement(credentialString, AccessKeyName),
                                                      SecretKey = ExtractElement(credentialString, SecretKeyName),
                                                      SecurityToken =
                                                          ExtractElement(credentialString, SecurityTokenKeyName),
                                                      ExpirationDate =
                                                          AwsTemporaryCredentials.GetExpirationTimeFromMilliseconds(
                                                              ExtractElement(credentialString,
                                                                             ExpirationDateKeyName))
                                                  };

        return credentials;

    }

    ///
<summary> /// Used to extract a piece of data from a json string.
 /// </summary>
    /// This is a C# port of the Java version written by Amazon.com
    ///The raw string to exctract the element from.
    ///the name of the piece of data to extract.
    /// The value of the exctracted element.
    private static String ExtractElement(String json, String element)
    {
        bool hasElement = (json.IndexOf(element) != -1);
        if (hasElement)
        {
            int elementIndex = json.IndexOf(element);
            int startIndex = json.IndexOf("\"", elementIndex);
            int endIndex = json.IndexOf("\"", startIndex + 1);

            return json.Substring(startIndex + 1, endIndex - (startIndex + 1));
        }

        return null;
    }
}

This retrieves a AwsTemporaryCredentials object which I’ve defined as:

public class AwsTemporaryCredentials
{
    public string AccessKey { get; set; }
    public string SecretKey { get; set; }
    public string SecurityToken { get; set; }
    public DateTime ExpirationDate { get; set; }

    ///
<summary> /// Handles converting milliseconds since 01-01-1970 into a useable DateTime.
 /// </summary>
    ///The number of milliseconds since 01-01-1970 as a string
    /// A DateTime that is 01-01-1970 plus the number of milliseconds
    public static DateTime GetExpirationTimeFromMilliseconds(string milliseconds)
    {
        long longMillseconds;
        Int64.TryParse(milliseconds, out longMillseconds);

        return GetExpirationTimeFromMilliseconds(longMillseconds);

    }

    ///
<summary> /// Handles converting milliseconds since 01-01-1970 into a useable DateTime.
 /// </summary>
    ///The number of milliseconds since 01-01-1970
    /// A DateTime that is 01-01-1970 plus the number of milliseconds
    public static DateTime GetExpirationTimeFromMilliseconds(long milliseconds)
    {
        var ticks = milliseconds*TimeSpan.TicksPerMillisecond;
        var correctedDate = new DateTime(1970, 1, 1).Add(new TimeSpan(ticks));
        return correctedDate;
    }

}

So there you go. 3 steps necessary to obtain temporary credentials from the Token Vending Machine (using the anonymous method). Once we have a set of temporary credentials, we can use those credentials just as we would with a “normal” set of credentials to utilize Amazon AWS services. Tired yet?

Questions? Comments? Confused? Drop a comment below if you need any help. Don’t forget to follow me on Twitter @kenstone.

Advertisements

Me and My Lumia 900 – a pseudo-review

Make no mistake, I am a Windows Phone fanboy. I’m not a phone reviewer, but wanted to give a few notes on my transition from a Samsung Focus to the Nokia Lumia 900.

Pros

Beauty

The aesthetic beauty of this phone is undeniable. I find myself taking it out in public more than usual just so people can get a glimpse of it (we are talking about phones, right?). The cyan colored body reflects light differently so it seems to color shift as I go from cloudy daylight to office flourescent to homey incandescent. The hand feel is, in a word, solid. It’s as if the phone is invoking Paul Hogan, “Heh. That’s not a phone. That’s a phone.

There are no parts that give way to pressure, like a battery compartment would. Nor does the screen give in when pushed. It pushes you. Having one completely smooth side unblemished by plasticky buttons feels anthropomorphically delightful.  If you haven’t read the book, Universal Principles of Design by William Lidwell, you should. In it, you’ll see so many things that Nokia got right about this phone listed in that book.

Soft Keys

One of my biggest complaints about the Samsung Focus was the soft keys found on all Windows Phones; they seemed so sensitive! Any fleeting touch would trigger them and, because of the bottom curve of the phone, you would constantly be in proximity to them while holding the phone. Anyone with a meaty thumb pad knows what I mean. My kid would be watching Netflix and in a flash be back at the home screen.  She’s really good at knowing how not to hold the phone, and she’s not even three.

The Lumia 900, in contrast, has the squared off bezel and additional room between the bottom of the phone and the buttons. This bezel not only gives something meaty to hold on to (particularly in landscape mode), but keeps your hands from hitting those buttons accidentally. Beyond that, the buttons seem less sensitive and thus less prone to tossing you over to cute animal land in Bing. That bezel is your home row and it gives your hands something to do without fear of blowing the whole thing up. It’s another design feature that helps users feel safe while using the device. You, my friendly tech geek cohort will hear your mom say, “Oh no! What did I do?” less when you loan her your phone.

Nokia Apps

The Nokia apps that I installed are App Highlights, Nokia Drive, Creative Studio, and Nokia Maps. I don’t live is a super populated area, so I’m unable to test some of the features of the Nokia Maps. My biggest plus is the Nokia Drive app which finally gives turn-by-turn driving. The Bing maps directions are great, but I really disliked having to keep tapping the screen to go to the next step. Creative Studio does the same thing with photo filters that a hundred other do, so maybe Nokia can sell that to someone for $1 billion some day.

Bigger Screen

Yup, it’s got a bigger screen than the Samsung Focus did. As a developer, I’m grateful that the resolution requirement hasn’t changed yet. I figure it will someday, but until then, I don’t need to change any of my artwork. I get to see everything a little bigger (and, if I’m being honest, I need to see things a little bigger lately).

Others

I have a Jabra CRUISER (which I highly recommend) that I use in my car to control my phone and talk hands-free. I’ve noticed that the Lumia connects to the bluetooth noticeably faster than my Focus did. And Visual Voicemail is here! I have my voicemail forward  to Google Voice where it is transcribed and sent back, so I’m not likely to use this feature much as I am not fond of voicemail. Voice Quality: every time I think the voice quality is a little weak, I realize my ear is not near the earpiece. So that’s straight up user error and the quality is superb when I’m in the zone.

Cons

It wasn’t until after I had pre-ordered the 900 that I realized it didn’t have the same curved glass screen of the Lumia 800 , which I was really looking forward to. Not only is it not curved glass, but the screen has a lip on it before stopping abruptly into the curve of the body. Instead of a dead flat surface, it has a rim. It probably works well enough to keep your beverage contained when you need an impromptu coaster (what else am I gonna use the gorilla glass for?) I’m guessing this was a cost consideration to get the phone down to the $99 street price, so I suppose its understandable. But I don’t have to like it.

This is not a con of the phone, but of the upgrade process in general. Moving from one phone to another phone is much more difficult than it should be. Things get lost. In my case, game data, SMS messages, and settings.

Conclusion

Yes, you should go out and get a Lumia 900. Now. Tomorrow. Especially now that it looks like they’re giving $100 credits to all purchasers before April 21. Get one for your mom and dad. And one for your spouse and probably a kid or two.

*drops the mike*

*picks the mike back up*

Don’t forget to subscribe to my blog and follow me on Twitter @kenstone. Let’s get that follower count above 100!

Announcing – St. Patrick’s Photo Booth for Windows Phone

Just in time for St. Patrick’s Day on Saturday, I’d like to announce the release of St. Patrick’s Photo Booth on the Windows Phone Marketplace. Similar to the highly popular North Pole Photo Booth, this springtime version features St. Patrick’s Day and other Irish themed props. It uses the same face detection to automatically place a hat on your photo which you can easily swap out for others. Zoom, rotate, flip, lock, and delete props with simple finger gestures.

Speech Bubbles

New for this version is the addition of editable speech and thought bubbles. Just drop one onto your photo, double-click on it, then use the on-screen keyboard to write something clever.

Collaboration

This time around, I collaborated with Justin from Adkins Software Development on some new features such as integration into the photo hub and enabling a trial mode. Expect to see more in the future from this collaboration. Check out his app, WP7 Tracker, in the Marketplace.

So go check it out! It’s a fun app for a night of green beer and jig dancing!

Analysis: One Month of Downloads on Windows Phone Marketplace

North Pole Photo Booth Download Graph

What you see is a graph of the downloads of the North Pole Photo Booth for its first month on the Windows Phone Marketplace (actual download numbers have been removed as they are not relevant to the discussion). Since this app was intended as a Christmas holiday themed app, this graph is perfect as it shows the effective lifespan of an app from launch to the main event — Christmas.

We Three Peaks

There are three primary peaks that jump out at us. The first is the launch peak, a very common and expected shape. I also purchased advertising on the windowsphonegeek.com App Wall for one month, but am unable to assess its impact given that the campaign started on the same day as launch. It got caught up in the launch peak. This was a good day for the app and got it off to a good start.
 
 The second peak is the downloads after the app was featured on wmpoweruser.com. This was the first time I’ve had an app written up there and, while the bump was expected, the magnitude of the bump was not. The peak is higher than the launch peak! Very impressed. Note to self, make sure all future apps are showcased on wmpoweruser.com. I also submitted stories for review on other sites (wpcentral.com, wp7applist.com) but it did not get picked up on any other site, so there are no more peaks to look at until the main event. I can say that the ad revenue generated for the app was highest on this day, so the people attracted by the site were high quality to advertisers compared to the other peaks.
 
 The 3rd and final peak is Christmas day. Ah Christmas. This peak is bigger than the other two and I assume are new phone users. That peak begs so many questions. This app was a holiday themed app and so was applicable to the day. Do all apps exhibit a similar peak? It was also a free app, so what does a paid app look like on Christmas? I hope people had fun using the app with their friends and family and that it put a smile on some faces.
 
 

O Holy Marketplace

One other thing to notice is the relatively flat download count in the weeks leading up to Christmas. This is only interesting because of what’s missing. No spikes. I say this because the Windows Phone Marketplace was featuring a couple Christmas themed apps every day for weeks. But North Pole Photo Booth never got chosen. A competitor got chosen twice. In fact many of the apps that were featured did so twice. Also, despite what the guidelines say, most of the featured Christmas apps were paid apps. I’m not sure anyone can say for sure why something gets chosen or doesn’t, but I assume that there would be some decent spikes had it been picked up.
 

Silent Night

The downloads for this app fell off sharply after Christmas day. Ad revenue went way down. This is not unexpected as it’s a Christmas app and Christmas is over. We’ll take a look next year to see how it ramps up again. Overall, I’m pleased with the app and it beat my expectations and so I’ll call it a success. It made it into the top 2% of all apps and was positioned nicely among photo apps. However, I’m not quitting my day job anytime soon.

Questions or comments? Let me know. Don’t forget to follow me on twitter (@kenstone) for more bits and pieces of my awesomeness. Also, follow my new blog, Trash My Stuff, where I’ll cronicle the sale and disposal of many of my unnecessary possessions.

Announcing – North Pole Photo Booth for Windows Phone Mango

Merry Christmas!

To enhance your holiday, I present the North Pole Photo Booth! Using the live camera feed from your Windows Phone, take a picture of your friends and family and watch as Santa’s hat appears. You can change hats or add more accesories to complete your holiday look. Already have a picture that you want to make Christmas card worthy? Just choose one from your media library and watch the magic happen.

How does it work?

The North Pole Photo Booth uses advanced facial recognition technology provided by face.com to detect your face and determine where to put the Santa hat. You can move the default hat, zoom it, and rotate it. Want to add more props? Click on the “add clothes” button to choose from a number of Christmas hats and related props. Drop those on your picture and arrange them as you like. When you’re all done, click Save and the image is saved to your media library where you can upload it to Twitter or Facebook and text it to your friends.

Features

  • Take a new picture or load an existing one
  • Automatic face detection
  • Choose among 8 different hats and 10 different props
  • Add as many props to your picture as you’d like
  • Zoom and rotate props
  • Delete props
  • Supports portrait and landscape mode
  • Reset everything to their original positions to start over
  • Add snow to your picture
  • Offline mode (no face detection)
  • On-screen help

Where to Get It

North Pole Photo Booth is available free from the Windows Phone Marketplace. Merry Christmas!

Support WP7 Orientation Without Rotation

While working on a new app, I came upon a scenario in which I wanted the phone to support both Portrait and Landscape orientations, but I didn’t want the content on the page to rotate. I wanted the user to feel that they had rotated the phone, but the particulars of my app would make rotating the content nonsensical. What advantages are there for this? First, from the user perspective, if your app has an app bar and supports multiple orientations, the app bar rotates the icons and the menu items fly in from the sides. Everything is right side up, providing a great experience to the user. Second, supporting multiple orientations allows you to receive the OnOrientationChanged event and make easy calls to determine the orientation of the phone.

Before I begin, If all you want is the second option, the best way might be to only support Portrait (or Landscape) orientation and use the OrientationHelpers class from the Level Starter Kit sample. In my case, what I really wanted was the app bar buttons and menu to work as normally expected in both orientations, so OrientationHelpers wasn’t sufficient.

The easiest way to keep the content from rotating is to add a counter rotation to the Page using a RenderTransform of type CompositeTransform. Your XAML would look like this:

<phone:PhoneApplicationPage>
.
.
.
    <phone:PhoneApplicationPage.RenderTransform>
        <CompositeTransform x:Name="pageRotator" CenterX="0" CenterY="0" Rotation="0" TranslateY="0" TranslateX="0"></CompositeTransform> 
    </phone:PhoneApplicationPage.RenderTransform>

</phone:PhoneApplicationPage>

This is added to the XAML of the page and the properties can be entered and bound just like most Silverlight properties. Here, I changed the properties in the OnOrientationChanged event in the code behind.

protected override void OnOrientationChanged(OrientationChangedEventArgs e)
        {
            switch (e.Orientation)
            {
                case PageOrientation.PortraitUp:
                    pageRotator.Rotation = 0;
                    pageRotator.TranslateY = 0;
                    pageRotator.TranslateX = 0;
                    break;
                case PageOrientation.LandscapeLeft:
                    pageRotator.Rotation = -90;
                    pageRotator.TranslateY = 480;
                    pageRotator.TranslateX = 0;
                    break;
                case PageOrientation.LandscapeRight:
                    pageRotator.Rotation = 90;
                    pageRotator.TranslateY = 0;
                    pageRotator.TranslateX = 728;
                    break;
            }
    base.OnOrientationChanged(e);
        }

Obviously, if you’re an MVVM purist, you can put all this in the ViewModel and have the XAML databound to properties. The above code checks what orientation the phone was changed to and then sets the transforms on the CompositeTransform accordingly. If we only had a RotateTransform, the page would rotate, but would be off the screen. Here, I’m supporting a device of resolution 480 x 800 with an app bar of 72px tall.

Below shows how I wanted the screen to look in 3 orientations.*

* Since this was some Photoshop work, sharp eyed readers will note all the icons in the app bar in Landscape Down are in the wrong position. They would be right side up, but in the reverse order. The idea is evident, though.

My Top 5 Windows Phone Mango Features for Consumers

 Windows Phone 7.5 (Mango) is a huge upgrade for Windows Phone users. There’s a crazy number of new features and it’s hard to pick just five. But let’s try, shall we?

Twitter Integration
This is totally what I wanted from Twitter integration on Mango. I love being able to easily post photos from the camera directly to Twitter, update my status from the “Me” tile, and read tweets from single contacts or groups of contacts right on the front page. That tile flips over and I get to see what someone said. Just like we’ve been able to do with Facebook. I initially had some issues linking Twitter contacts, but I wrote about how to link them up so that should make it easier.

Live Tiles
Live tiles prior to Mango were possible, but implementation by developers was weak and inconsistent. With Mango, developers have been given some significant powers to make their tiles awesome and engaging. I really hope that developers take advantage of this feature and drop some cool stuff in there. Not just the primary tile. I want to see secondary tiles with deep links. C’mon!

Voice Text Messaging
I experienced this feature the first time while driving in the car and it was a total surprise. I received a text message and suddenly the phone started reading the message to me! Then it asked me if I wanted to reply! I said sure, spoke my message out loud, and there it was on the phone. A little back and forth without having to touch the phone. Totally seamless and natural. Killer. Works while connected to bluetooth.

Camera Touch to Snap
Any random with an iPhone knows how to focus the camera by touching anywhere on the screen. But what they can’t do is take the picture at the same time. Mango can. Not only can you focus on a particular part of the screen by touching it, but the camera will take the shot at the same time. Then, uploading to Twitter is just a couple taps away.

Linked Inbox
I enabled this feature immediately for my Exchange account and a Gmail account. In general, I’m not a fan of linked inboxes; I tend to keep them separated to keep my sanity. But I’ve actually never turned off the linked inboxes. It’s really easy to add a new one and the single email count on the lock screen is awesome. Sending new messages is just as easy.

So there’s five. Maybe we’ll do another five some other time as there’s just so much to talk about.

Core77 Fast Track to the Mobile App Contest

Looks like the awesome folks over at Core77 are sponsoring a windows phone app development competition along with Microsoft. All you have to do is come up with an idea and present it with a 500 word description, up to 5 mock up screen images, and optionally a video and/or SketchFlow prototype. What’ll could you win?

Five winners receive an App Development Deal with a revenue-splitting partnership option, Windows Phone device, Xbox 360 with Kinect, and an App Hub subscription. 100 finalists receive an App Hub subscription with access to free developer tools, and twenty-five semi-finalists also win a Windows Phone device.

Looks like a good deal for someone who wants to get involved in windows phone programming For more information, check out the Fast Track App Competition contest site.

Twitter Contact Linking in Windows Phone Mango

This confused me a little bit from the get go, but it turns out I had made it harder on myself without realizing it. When I turned on the Twitter integration on Windows Phone Mango, the first thing I noticed is that now my people tile was full of contact photos from Twitter. I don’t follow that many people (136), but all those people were now filling my contacts list. Just imaging what yours will look like! This was no good to me, so I filtered them out.

If you go into settings in the people hub, there is a button that says “filter my contact list”.
IMG_9965

Tapping this lists all of the accounts that you have. I unclicked Twitter and, voila!, no more Twitter contacts in my contact list.

IMG_9966

This does not mean that you can’t see Twitter updates on the “what’s new” tab. To make sure you’re seeing Twitter updates on the “what’s new” tab, click on “what’s new” and choose “Twitter” on the “show updates from” window.

What happened to me was, now that I didn’t have Twitter contacts in my list, I couldn’t see how to link a Twitter account to a phone account so that updates would show up in their tile. This is where it turns out I was not looking closely. In your Twitter feed on the “what’s new” tab, clicking on the person’s name will bring up that contact card. Clicking on the post itself will show you that post. That’s where I got confused.

IMG_9967

Slide over to “profile” and there in the app bar is the “link” button that allows you to link contacts just like you could in all other accounts.

IMG_9968

Had I not removed Twitter from my list of contacts I could have found the contact in the list and done the contact link normally. I don’t have a Facebook account, but I assume the process is the same for that.

My Top 5 Mango Features For Developers

Update: see my article on my favorite mango features for consumers.

My first Windows Phone 7 app was an internal project not meant for general distribution. I was excited to use my existing skills on a new platform. But soon after starting that project, I ran into a number of hurdles. Some were surprises, some were expected. After seeing Mango demos at MIX 11, I knew that, going forward, developing was going to be much more pleasant. Here’s a look at the best 5 features for developers on Mango.

SQL CE and Code First EF
Prior to Mango, there was no built-in database. This was my first and biggest surprise. I just assumed it would be there since even Windows Mobile 6.5 had SQL. Mango changed that and provided us with a “code first” gateway into creating app databases with SQL CE. I love LINQ and I love decorating a class with attributes in order to create a database. It’s easy and with LINQ lets me feel right at home. I wish the database was faster on reads and one thing I am not looking forward to schema changes in a production app. I know there’s an upgrade mechanism, but I’m cautious. Hands down, this is the most important new feature for me.

Beta and Private Distribution
Devs are allowed 3 devices to “unlock” for development. Lucky for me, the app I was developing was only for 3 people, so I unlocked their phones for them to test it. Eventually I published it on the marketplace (so I wouldn’t have to plug in their phones every time there was an update) and to this day people still download it. But sometimes you want way more than 3 people to test your app.

Beta and private distribution isn’t a mango feature per se, but it came out around the same time. I used the beta distribution my latest app which enabled me to let others test my app without needing to unlock their phone. Unfortunately, you can’t update an existing beta. I know the reasons for this, but I wish there was an option to let the dev say, “It’s okay. This app can be updated”.

Performance Analyzer
Honestly, I don’t really know what I’m doing with this tool yet. I know the general idea, but haven’t used it enough to really get the hang of it. In my latest app, I could sense a sort of “stutter” when switching panels on the Panorama control. Running the performance analyzer confirmed this: during a panel change the frame rate had this odd stutter. Unfortunately, I couldn’t figure out how to eliminate the stutter. So I changed to a pivot control instead. It wasn’t quite what I wanted (although now I’m glad I did), but at least I had the analyzer there to help me make that decision. I’m looking forward to this tool becoming more useful over time.

Multitasking
The missing feature people loved to hate on. Sure, prior to Mango, there was no real multitasking. Now that I have it, I’m super glad I do. But devs still need to be careful with their app. You can’t assume that your app is still running, and so there is some work to do. Luckily, fast application switching comes for free (as long as you do your own housecleaning if necessary).

Background agents are a cool way to deal with certain ongoing tasks. I used a background agent to do work that I might have had a push notification do before. Doing a background agent allowed me to offload that work to the client, rather than having a server take care of the work and send a message along to the client. Background Audio is pretty sweet too.

Live Tiles
One of my favorite new features in Mango is live tiles. I love that we can change within the app (or background agent) the primary tile, add or remove content to the back of the tile, and add secondary tiles (with deep linking) all without needing to rely on the network for push notifications. The user experience is a little more consistent and reliable and I love watching the tiles flip and do their thing. Pushing this a little further, I wish we could put our own icons on the lock screen.

So there you go. My top 5 features of Mango for developers. There’s a lot more and I’ve yet to use many of them (new camera api, gyro, etc.) but Mango gets me a long way to what I need to write the apps I want to write.

Advertisements

I'm Ken Stone. I'm an indie developer with a focus on .NET and Windows Phone development. I have a day job, but everything I say is mine alone.

TechEd 2012July 11th, 2012
Let the learning begin.