Saturday, September 24, 2011

Windows Phone 7 – Quick Tip #33 – Be aware of the amount of memory your application is using

If you are building a Windows Phone 7 App, you should be aware that if your application uses more than 90MB of RAM it will get rejected from the marketplace.  One easy way to check how much RAM your application is using is to add Peter Torr’s  most excellent memory counter.  It adds an additional counter to your app.  You know, those counters…those funny little numbers on the right  to your application when you run it in the debugger.

Anyway, check out Peter’s post, and while you are there, you might as well subscribe to his blog…

http://blogs.msdn.com/b/ptorr/archive/2010/10/30/that-memory-thing-i-promised-you.aspx

Peter is a great asset to Microsoft and works on the Windows Phone 7 Platform Development Team.

-twb

Thursday, September 8, 2011

Windows Phone 7 – Quick Tip #32 – Read Contents of Local File

This Quick Tip was stolen for DevFish’s TackleBox app.  I wanted to put some configuration data into my application to be picked up at runtime.  For this approach Isolated Storage didn’t make a lot of sense.  This data was stored as a simple text file, but it could be an XML document, JSON or even and image.  I just needed to get my hands on the content of the files and do something with it.  After fixing the bugs in Joe’s code, I found you can access these files with the following code snippet:

image

Where the file name that is passed in will be the full name of the file.  In our case we would pass in something like Manifest.txt.

One very important note:  Even though you are calling Application.GetResourceStream, you MUST specify that your content type is of type Content.  This will make sure the file gets packaged up and included with your XAP and not compiled into your binary.

image

-twb

Wednesday, September 7, 2011

Windows Phone 7 – Quick Tip #31 – Safely Save Passwords in your WP7 App

Normally you save your application settings in Isolated Storage, this is pretty secure, but really isn’t the best approach for storing stuff you need to protect.  Although I guess anything is possible with enough time and computing horse power the Windows Phone 7.1 SDK provides a more secure mechanism to store things like passwords or application keys.  It’s called ProtectedData and provides a mechanism to takes byte arrays and encrypt them and turn them back into their original state.  This class is in the System.Security.Cryptography namespace.

This could be a simple way to use this to protect passwords in your application.

image

Just as a heads up if you try to use this in your XNA application, you’ll need to add the assembly mscorlib.extensions to your application.

-twb

Tuesday, September 6, 2011

New Short URLs for Florida Developers WP7 Apps

If you are registered on the FL App Developers Site http://www.flwp7.com we have a new feature available to you. 

Here was the problem…you were out and wanted someone to download your app or you wanted to put a link to it on some printed marketing material.  In the past you had to enter the big old Zune based URL like zune://navigation/?phoneAppId=b7522342-4235-a532-be54-13bc43ef1423 which was pretty much impossible to enter correctly.

With this new feature available to you from the Florida Developer Community Site, you can create smaller, more friendly URL’s that can easily be entered to bring people to your application.  For example with the URL http://flwp7.com/cs you’ll be brought to the market place page to download ContactSwap. 

To use these, make sure you and your apps are registered as a developer at http://www.FLWP7.com.

Then simply when entering your applications information, specify a few letters to create the unique URL at the bottom of the page.  For ContactSwap I entered the code CS:

image

This will allow anyone that navigates to http://flwp7.com/cs on their phone to be brought directly to your app on the marketplace.

While you are on the www.FLWP7.com site, make sure that you browse the apps that all the local folks created and download a few and check them out!  Support your local App Developer =D.

-twb