November13

Football Apps Experiment Update Nov 2012

I started this little experiment for Windows Phone as a test.  First, I am a football fan and love to get news on my favorite team.  But I wanted to see if a team specific app approach would work with NFL teams.  I only did a few of the teams based upon their social network popularity.

20% trial conversion!

This REALLY surprised me.  I had previously only built and released apps for free.  The total amount I made on those apps was quite disappointing.  I was half expecting to only see a few dozen downloads of a trial to paid app after all the information I had read about free app vs paid app downloads.  Maybe that is true for games, but in my sports apps the paid got a lot of trial downloads.

image

949 Trials generated 190 paid users.  That is something I did not expect.  I made way, way more money from the paid app that I ever would have made from ads running in those apps.  If I look at a similar app that is free and has about the same number of sessions for this period (one of my non football apps) I only made $3.65 for that period.  Compare that to the $283.10 I made from the NFL apps.

I have been selling apps for mobile devices since the late 90’s and this is the best conversion rate I have ever had.  Of course the Windows Marketplace makes that possible.  You would never have been able to get 1,000 people to download your trial after finding you in some search engine.  I did have good success on Blackberry in the early days, but it all points back to having a store is key.  I think this is why app developers on Windows 8 (PCs, not phones) will do so well.  Imagine having a market of 400+ million users to find you in the store. 

More...

September21

Windows Phone NFL Fan Update after week 1

OK, another week has flown by and I wanted to update the app numbers.  Mostly because I am dying to know myself how things went, and partly because I have an update for all of my football apps in the marketplace pipeline.

Waiting for the marketplace

I personally really hate that time between when you have added a new feature and can’t wait for users to get their hands on it, and when it actually happens.  For me it seems to be about 8-10 days.  There is the 5-7 day app review, and then once you are certified it still takes another 2-3 days before people get the update.

But this is really a small delay, it is just the desire to see users with the latest and greatest that makes the waiting period so hard.

Interesting Information about Downloads

 

More...

September13

NFL Windows Phone Apps Update

It has been a few weeks since most of my NFL fan apps for Windows Phone have launched in the marketplace. I thought it would be a good time to go through some numbers and show what I am seeing in the marketplace for downloads and purchases.

If you are not sure what the heck I am talking about, please read the post NFL Fan Apps for Windows Phone.

NOTE:  The apps came into the marketplace in waves as they were approved.  The Raiders Fan app has zero downloads in this because the reporting from the marketplace has not caught up yet.  I will come back and make another post later.

All of the downloads and reports in this post are from August 18 – September 6.  That is just before opening weekend in the NFL.  I expect to update this in a few weeks with better numbers.

I made some money

What’s the good news?  Well over 100 people downloaded my apps.  And 19 paid for them!

 

 Interesting to note that the one paid for the most was not the first one released.

More...

May13

About Mariners News for Windows Phone

I built an app just for myself recently and decided to share it.  Those are always the best apps to build, ones that have some personal meaning or use for yourself.  And this one is no exception.

You can download this app from the Windows Phone Marketplace – Mariners News.

2 hours – ready, set, go

I attended a class where we had just two hours to make a start to finish app.  I actually didn’t intend to build this app, and had no idea we were going to do this at the event.  I am actually quite glad we did, as it showed me I could do a lot more in a phone app in just a few hours than I would have thought possible.

Request Data from Bing

The previous topic of the class had been using the Bing API to make requests for data and news stories.  Just that morning I had been looking for a way to get news about the Seattle Mariners.  There was one app in the marketplace, but the UI was terrible and slow.  Viola, an idea is born.

Version 1.0 total time spent 3:15

image

Ok, I did make the app in under two hours, but I spent an additional hour and fifteen minutes at home that night making the icons, testing for the marketplace certification, putting in the Ad control, and preparing the submission.

Trademarked material

 

Oops, I grabbed the official MLB logo when I built the icons.  I wasn’t really thinking about it the night I submitted, I just went to MLB.com and grabbed the official logo.  Almost the next day the Windows Phone

Developer Blog came out with an article about avoiding trademark trouble

I should have known better.  Really, I have done this type of thing before.

Designing my own logo

So I sat down that evening using Expression Design and built a new logo.  It is close enough for people to recognize it as the logo, but it is my version of it.  No trademark or copyright issues!

 

Quick, simple and clean.  I like it.

Waiting on certification

And then I began the long wait for certification (which you can’t cancel or abort).  So I thought what else would I want to change?  I am going to need to submit an update anyway, better make it worth it.

Navigation and other changes

MainScreenAt this point I thought more about the navigation experience.

I didn’t like the display of the news articles and with about two evenings of playing I came up with the following design that I am much happier about.

Notice the stories are cut at two lines, if you click you get the complete RSS or news story as it was returned from Bing.  Then if you want you can launch out to IE from that more detailed page. 

I got rid of the images for the source (too much space), and just added an tagline, then about how long ago it was posted.  Seeing the date and time doesn’t really do much for you, but seeing about four hours ago seems to give it a fresher feeling.

Links and Social pivots

This is where I started thinking about what else I would do with a Windows Phone.  I want to check for tickets, directions to SafeCo, tweet about the game, etc.

Most of these are pretty simple stuff, but add a lot of usage to the app. 

Uniquely Mobile

The call for tickets actually goes call the correct Ticketmaster line for you.  I don’t know of any other sports app that does that, and it is a uniquely mobile experience.  You wouldn’t want that on your desktop, but on my phone it makes perfect sense.

Directions to SafeCo Field.  Another unique experience for mobile phones.  I may be lost downtown while going to a game (it happens).  Quick couple of taps and I am getting directions.

Get on demand updates of news and scores through SMS is a feature that ESPN offers.  But I can never remember the number, so I built it in.  Now with a quick tap I get the latest box scores or news.

Share the #mariners spirit is something I want to add more to over time.  The ability to profess the love for your team, taunt the opponent, or just complain about the call are all social elements to the game today.  I would like to build in more Twitter integration to let users interact about the game while watching a game.

Version 2 was ready before Version 1 was live

I actually finished this version of the app just a few hours after the version 1 was approved for the store. But even after approval it still takes 24-48 hours before an app goes live on the site.

I was very happy to be able to submit a quality update almost immediately.  Now I just have to wait for it to be approved! 

Better Live Tile

This was a really fun project, and one that I am sure I will continue to update as I find more things I want in it myself.

I am already thinking about a way to use a live tile to show me the next team opponent and the time of the that game.  Too bad you can’t add calendar items on WP7, maybe a push notification that the game is getting ready to start?  Hmm.  I can listen using MLB At Bat to every game, so that might work.  Ahh the possibilities.

Enjoy your projects, and hopefully from baseball this year too!

 

March23

Inside Windows Phone # 34 - Talking CRUD with Jason Short

The interview I did for Channel 9 Inside Windows Phone is now up!

Channel 9 MSDN Link

Embedded Video

My thanks to Larry for having me on the show to talk about CRUD. People seem to think that with mobile apps the basic concepts of CRUD have gone away, but that is not true! You still need to think through the basic data operations the same as almost any other application.

Here is the post for the original XAPFest talk.

XAPFest talk Managing Data on Windows Phone 7

February20

Minimal Virtualized Data List for WP7

I recently gave a talk about data management on Windows Phone 7 for XapFest and I put in a slide about virtualizing your data for data bound objects.  I didn’t really think it was that big of a topic when I was putting together the talk, but it generated a lot of interest from attendees.

I am going to demonstrate the minimal virtualized data collection object you can easily create for data binding with a Listbox.

For this example I am using a simple class named FeedItemDataModel.  This represents a class that holds a single item from an RSS Feed.  In this simple implementation the values are simple and set in the constructor.

The sample application shows a UI with a collection of this object databound to the UI and lets you jump to a specific index in the list.  The red text you see is a memory watcher class that shows memory usage within your app.

More...

February17

Create a file from a resource on WP7

I got an email from someone today asking about how to take a resource from their XAP (which is read only), and put it in a location where they can update the file. 

Initial Data Load

I highly recommend this approach for getting an initial data load for your application.  Give the application a base of files to work with rather than requiring an initial round trip to a server for those files.  It is fine to need to update them almost immediately.  Think about the scenario where the user has no network access (a first run of the app this is really vital).  Does the user get an error that no data is available, or do they get a nice default experience?  Even if you just put in data that says “no data here yet”, that is better than a blank screen to the user.

Create File From Resource

I put this in a utilities class as a static method since it doesn’t really need any state.  One thing to ensure you do is put a using() block around the objects that are disposable.  This ensures they are cleaned up and released as quickly as possible.  I think this is a common reason why people think they need to GC.Collect, they are not cleaning up memory.

public class FileUtilities
{
/// <summary>
/// Given a resource name, create a file in the isolated storage.
/// Resources are read only, but copying them to the isolated store means you can edit them.
/// Useful for including a starter file in your XAP, and then copying it out to storage
/// for editing it at runtime.
/// </summary>
/// <param name="resourceName">The name of the resource</param>
/// <param name="fileName">Optional param for the name of the file, 
///
by default uses the same name as the resource</param> public static void CreateFileFromResource(string resourceName, string fileName = null) { // Find the resource and get the stream // Note the using() block to ensure this gets cleaned up when we are done using (var resourceStream = Application.GetResourceStream(
new Uri(resourceName, UriKind.Relative)).Stream) { // Get the location where we can write files using (var userStorage = IsolatedStorageFile.GetUserStoreForApplication()) { // Use the filename (if given) or the resource name using (var newFile = userStorage.CreateFile(fileName ?? resourceName)) { byte[] byteBuffer = new byte[4096]; int bytesRead = -1; while ((bytesRead = resourceStream.Read(
byteBuffer, 0, byteBuffer.Length)) > 0) { newFile.Write(byteBuffer, 0, bytesRead); } } } } }}

Please forgive the formatting above, trying to make it fit on a smaller size screen.

February06

Using a custom attribute to determine type at runtime

On a Windows Phone 7 project I am currently building I had a need to build a factory that instantiates different concrete classes depending upon an object at runtime.   I have a number of information feeds, that all have different classes built to actually go get their data.  One for RSS Feeds, one for Twitter, etc.  Each Feed has a property for the FeedType, this is the information needed to determine what class to instantiate at runtime.

I have written this pattern many times, but I ran across an interesting post on StackOverflow where Steven gave a different approach to solving this without the classic giant switch statement in the Create method.   I thought it was neat enough to use in my application and share here.

There are a couple of steps you have to take, but none of them are difficult.

  • Decorate your objects with a custom attribute
  • Build the object types using reflection
  • Implement your factory method

Custom Attribute

The attribute I added is called FeedTypeAttribute, I then add it to the concrete feed processor classes.

class FeedTypeAttribute : Attribute
{
private int _feedType;

public FeedTypeAttribute(int feedType)
{
_feedType = feedType;
}

public int FeedTypeId
{
get
{
return _feedType;
}
}
}

Adding the attribute to a class looks like the following.
 
[FeedTypeAttribute(1)]
public class StaticFeedProcessor : IFeedProcessor
{
public StaticFeedProcessor()
{

}

public void ProcessFeedModel(FeedModel feedModel)
{
throw new NotImplementedException();
}
}

Note that this class would be a FeedType of 1 in my data, but how do you determine what class that is during runtime?  The answer is reflection (and yes, this does work on Windows Phone 7).
 

Factory Method Using Custom Attributes

public class FeedProcessorFactory : IFeedProcessorFactory
{
private static Dictionary<int, Type> processorList = new Dictionary<int, Type>();

static FeedProcessorFactory()
{
// Get the types in this assembly that implement our custom attribute
var targetTypes = from type in Assembly.GetExecutingAssembly().GetTypes()
where type.CanBeTreatedAsType(typeof(IFeedProcessor))
where !type.IsAbstract && !type.IsInterface
let customAttributes = type.GetCustomAttributes( typeof(FeedTypeAttribute), false)
let attribute = customAttributes[0] as FeedTypeAttribute
select new { type, attribute.FeedTypeId };

processorList = targetTypes.ToDictionary(p => p.FeedTypeId, p => p.type);
}

public IFeedProcessor CreateProcessorByFeedType(int feedId)
{
Type feedType = processorList[feedId];

return Activator.CreateInstance(feedType) as IFeedProcessor;
}
}

The key here is the type.GetCustomAttributes() call.  The linq expression gets all the type of the current assembly where the type can be assigned from the IFeedProcessor class.  We have to ensure the class is not abstract or an interface, and then get the custom attributes. 

The let clause in the linq expression can be thought of like a local temporary variable.  Assigning the attributes to it, and then processing them in the final select.

Consuming the Factory

Consuming the factory is then as simple as instantiating a factory object and calling the CreateProcessorByFeedType function.  A fully allocated processor is returned ready to handle the feed.

// This is in my container object
private static IFeedProcessorFactory _feedProcessorFactory = new FeedProcessorFactory();


// This is in the function to process the feeds
IFeedProcessor processor = _feedProcessorFactory.CreateProcessorByFeedType(feed.FeedType);
processor.ProcessFeedModel(feed);

Less Coupling is Good

This code allows for the addition of new processor classes just by building the class and adding the custom attribute.  Of course you should check if the feedtype is not supported before trying to use the object (I omitted some code used for safety checking).
 
If a newer class is created in the future to replace a current one I only have to change the custom attribute to handle it.  No switch statements, or remembering to update a config somewhere.

February02

Is this .Net Type Assignable from another Type?

I have run into this a few times and always have to go to the MSDN to find the answer.  I have a situation where I needed to determine if a given type can be treated as a base type in an object factory.  I wanted to be able to create my concrete classes without having to do a switch statement for each type.

First I had to determine if the types were assignable to each other, then find the type to implement.  I will cover that in another article.  In this one I just want to cover the assignment test.

Can this type be assigned?

There is a function IsAssignableFrom that you can call on a System.Type. 

if( ParentType is ChildType )

It actually has to be written the other way around.

if( ChildType.IsAssignableFrom(ParentType) )

Quick Extension Method

So instead of having to do that all over my code, I wrote an extension method to allow me to do it following a different ordering.  I actually got this basic idea from one of the comments on the MSDN page.

if( parentType.CanBeTreatedAsType(childType) )

As you can see the extension method lets you write the syntax in a more natural manner.  Your preference may differ, but this makes more sense to me.

Example Code

public static class DataExtensionMethods
{
public static bool CanBeTreatedAsType(this Type CurrentType, Type TypeToCompareWith)
{
if (CurrentType == null || TypeToCompareWith == null)
return false;

return TypeToCompareWith.IsAssignableFrom(CurrentType);
}
}

void Main()
{
System.Type parentType = typeof(ParentClass);
System.Type childType = typeof(ChildClass);

bool ChildToParent = childType.CanBeTreatedAsType(parentType);
Console.WriteLine("Child can be treated as parent: " + ChildToParent );

bool ParentAsChild = parentType.CanBeTreatedAsType(childType);
Console.WriteLine("Parent can be treated as child: " + ParentAsChild );
}

public class ParentClass
{
public ParentClass()
{
}
}

public class ChildClass : ParentClass
{
public ChildClass() : base()
{

}
}

January04

Debug Secondary Tiles

This is another of those posts for my future self, because I know I won’t remember this little tip.

Set startup through app manifest

The WMAppManifest.xml has a property that tells it where to send the default launch of the application.

    <Tasks>
      <DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
    </Tasks>

So the normal launch page is MainPage.xaml. But you can change it to another page, and include your parameters just like from a secondary tile!

    <Tasks>
      <DefaultTask Name="_default" NavigationPage="/TileDetails.xaml?myid=2" />
    </Tasks>

Now you can just press F5 and debug just as if that secondary tile had been clicked.