# Sunday, February 12, 2012

Follow Up from Windows Phone Camp Bristol

A few of you who attended the Windows Phone Camp in Bristol asked about the slides and code from the Storing Data and Cloud/Networking session. I've uploaded the latest versions of these slides and the additional Sockets code project to the FTP site. All the links and resources mentioned during the day are on Pete's blog post:-

http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/11/13/links-and-resources-from-windows-phone-camps.aspx

Happy Coding!

#    |
# Friday, January 20, 2012

Review: Making Embedded Systems (Elecia White)

This title takes a traditional software programmer into the world of embedded system. It covers the process of designing and implementing an embedded system from a sketch through to optimising performance and power consumption.

As an interesting addition, at the end of each chapter, there is a potential interview question for an embedded developer position. It’s an unusual idea but is a way of tying up the topics covered in the chapter. Because the book is written for developers it applies patterns and techniques which the reader will already be familiar with and how they apply to embedded systems.

It emphasises the need to be aware of the limited resources available and how to pare down operations to a minimum to make best use of them. It also talks about various options for input and output for a variety of peripherals and sensors.

The book offers a useful introduction to the world of embedded development to a developer with existing C (or similar) experience. More experienced embedded developers will probably want to delve into more detail on the specific areas, but this is a great starting point.

4/5

#    |
# Friday, January 06, 2012

Windows Phone Update due shortly

Microsoft have published details of a new update (7.10.8107.79) which adds a number of fixes to the Mango release. It fixes the issue where the on screen keyboard will randomly hide itself which I've been finding frustrating recently and also a fix for the SMS bug which could disable messaging. It also hopefully finally resolves the issue when forwarding Exchange messages where the original message body would disappear. It hasn't shown up yet but expect it over the next couple of weeks. Full details on all the updates and fixes are published here:-

http://www.microsoft.com/windowsphone/en-us/howto/wp7/basics/update-history.aspx

#    |

Windows Phone Update Due Shortly

Microsoft have published details of a new update (7.10.8107.79) which adds a number of fixes to the Mango release. It fixes the issue where the on screen keyboard will randomly hide itself which I've been finding frustrating recently and also a fix for the SMS bug which could disable messaging. It also hopefully finally resolves the issue when forwarding Exchange messages where the original message body would disappear. It hasn't shown up yet but expect it over the next couple of weeks. Full details on all the updates and fixes are published here:-

http://www.microsoft.com/windowsphone/en-us/howto/wp7/basics/update-history.aspx

#    |
# Thursday, December 22, 2011

Developer Unlock Expiry

When you've developer unlocked your Windows Phone you can merrily deploy and debug on it and everything is great. If you've upgraded to Mango you had to run the Unlock tool again but this is fairly painless. What is not obvious is that the developer unlock has a 12 month expiry from when you first register the device and even when you subsequently use the unlock tool on the same device this never gets extended.

So one day you'll be developing as normal and get the error "Failed to connect to device as it is developer locked. For details on developer unlock, visit http://go.microsoft.com/fwlink/?LinkId=195284.". Instictively you launch the developer unlock tool, enter your App Hub credentials and unlock the phone. This completes with no errors but you'll soon find that it hasn't helped despite the fact you entered valid credentials and your App Hub account is valid.

The solution to this problem is to log into App Hub on the web and go to your account profile, select devices and remove the offending device from the list (here you'll see that the expiry date is shown). After doing this you can run the unlock tool again and successfully unlock the device.

Microsoft could certainly improve this process in the future by using a more descriptive error message and also by improving the unlock tool so that when you try to unlock a device that has expired it refreshed the registration and provide 12 more months of use (just like the manual process described above does).

Merry Christmas, and here's to a wonderful 2012 filled with Windows Phone goodness!

#    |
# Thursday, December 08, 2011

Submitting Apps to Marketplace with Background Tasks

I've been working on an update to the Tasks application which adds in background synchronisation using the new background task support in Windows Phone 7.5. As with any app when you submit your XAP static analysis is performed on it to check, for example, that you have declared the correct capabilities based on the functionality in your app. Within a background agent you are only allow to call a subset of APIs - as you would expect you can't play sound effects or draw to the UI (with the exception of toast notifications and tile updates). Because the main app has to include a reference to the dll which provides the background task, and the functionality within the dll is used in both the background task and the main app it made sense to move all of the logic into the background dll. This meant including a number of third-party references. I was very careful to ensure that nowhere in the background task was any restricted API called and it worked perfectly in testing.

The first problem is that upon submitting the static anaylsis looks at all of the referenced dlls and sees that they contain APIs not permitted in a background task and blocks the XAP. One of the culprits was InTheHand.Phone.dll (Part of Mobile In The Hand) because it provides a mixture of helper classes for logic and for UI. As I've been working on the 7.1 version in tandem I've now split this into two assemblies for Windows Phone 7.1 SDK projects. This means we can continue to use InTheHand.Phone in background tasks and add a reference to the second assembly in the main application only.

The second problem is that code within the sync logic calls ScheduledActionService.Add which is disallowed within a background task. This API is used within Tasks to add system-wide reminders (Another new feature for this version) for new task items. The code also has the ability to update and delete reminders based on modified or deleted tasks but these do not seem to have been flagged up as errors. This is a pain because it means that if the device syncs a new task with a reminder set to show before you next open the foreground app we won't have had a chance to register it.

The other issue with the NeutralResourceLanguage is an issue with projects originally created with an older version of the development tools. You can add this setting from the projects properties, Application tab and click "Assembly Information...".

This has been an interesting learning experience and shows that the validation picks up not just APIs used in the background agent code-path but also in referenced assemblies.

#    |
# Wednesday, September 21, 2011

Showing Mango Features on Marketplace

The Windows Phone team have posted to their blog about application updates with a couple of useful points:-

From October you will again be able to publish updates to your 7.0 apps independently from 7.5 (previously once you had published a Mango update your 7.0 app would be locked). It does mean potentially being in limbo for a month but at least you are not stuck completely with no way of updating a 7.0 app. This is important as it will take some time before many users will have the opportunity of upgrading to Mango.

When submitting apps there is only one description for both versions of your app so you must describe which features are for Mango only. For the purposes of Screenshots there is now an officially accepted overlay which can be used to indicate Mango-only functionality. You can download a ZIP containing the overlay and examples here:-

http://create.msdn.com/downloads/?id=882&filename=Marketplace_7.5_Badges.zip

The full blog post is here:-

http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/09/20/submit-windows-phone-7-5-apps-today-update-7-0-apps-in-october.aspx?utm_source=twitterfeed&utm_medium=twitter

#    |
# Monday, September 12, 2011

Working with Marketplace Exported Reports

When Microsoft refreshed the Windows Phone developer portal in advance of the Mango refresh they added various improvements to reporting, an important one being export to file (XLSX). When you open the exported payout detail reports in Excel and enable editing you'll see a number of warnings against a couple of columns. This is because the data is formatted as text but Excel recognises that the contents are numbers. In order to use these values in formulas or graphs you'll need to convert them to numerical values.

The easiest way I found to do this was to select an empty cell and Copy it, then select the entire columns of "Units Sold" and "Royalty", right click and select "Paste Special". From the popup select "Add" as the operation and click "Ok". Now all your number columns are really numbers (you'll see the formatting change to right alignment).

#    |
# Tuesday, June 28, 2011

Need a Windows Phone developer handset?

Are you a Windows Phone 7 developer in New Zealand? Are you in need of a real Windows Phone device to test and debug your apps on? If so I have a spare Samsung developer handset which is going free to a good home. Shipping is $5 to anywhere in New Zealand. I could ship it internationally but the cost would be higher. Contact me if you are interested. I have only one and it’s first come-first served!

Update - The phone has now been claimed

 

#    |
# Thursday, April 21, 2011

APPA Mundi Tasks 1.9

The latest version of our Tasks app has now hit Marketplace. This release builds on the improvements from my last blog post:-

  • We now have fixed an issue some users were encountering with synchronising Hotmail tasks in v1.8
  • We now support a wider range of Exchange Server 2003 mailboxes including those with non-standard security policies
  • Thanks to user-feedback we’ve improved the French and German text within the application
  • We’ve changed the timing of how the welcome message pops up in the trial version to avoid navigation issues
  • Based on user feedback we’ve added the option of putting undated tasks at the top or bottom of your To-Do list
  • Since version 1.7 we’ve changed the transition animations between pages to match the built-in applications (obviously this doesn’t come across in the screenshots!)

We’d like to say thanks for all the great feedback we’ve received from users. We’ll keep listening and adding to the product so keep it coming!

#    |
# Tuesday, April 19, 2011

Managing Processes and Memory With Mobile In The Hand 7.0

.NET Compact Framework

The Compact Framework provides the capability to start a separate process from your code, and stop it but it doesn’t give you more detailed information about what is running and what components are in use. Windows CE includes the optional ToolHelp component (present in all Windows Mobile versions). The InTheHand.Diagnostics namespace includes a number of classes for working with ToolHelp in a way which matches the full .NET Framework. The ProcessHelper class includes the GetProcesses() static method to return all running processes on the device. Extension methods GetModules() and GetThreads() return ProcessModule and ProcessThread collections for a specific Process.

ProcessModule exposes name, size and version information for an individual module. ProcessThread exposes id, priority and elapsed processor time.

Another way you might want to interrogate a process is to determine the memory usage. For your own process we’ve followed the Windows Phone model and so InTheHand.Phone.Info.DeviceExtendedProperties.ApplicationCurrentMemoryUsage

provides you this useful figure as a strongly-typed property. It is also accessible from the GetValue method as you would on Windows Phone.

Windows Phone

Other than the built in set of tasks you can’t start any other applications or tell if they are running. You do have access to memory statistics though which are accessible from the Microsoft.Phone.Info.DeviceExtendedProperties class. A limitation here is that if you use this method to get the memory statistics your app will automatically get marked as requiring the ID_CAP_IDENTITY_DEVICE capability which it doesn’t actually need for these properties. We built a helper class for two reasons – firstly to remove this requirement and secondly to provide strongly-typed properties as an alternative to the GetValue implementation. On Windows Phone therefore you can use:-

InTheHand.Phone.Info.DeviceExtendedProperties.ApplicationCurrentMemoryUsage

InTheHand.Phone.Info.DeviceExtendedProperties.ApplicationPeakMemoryUsage

and

InTheHand.Phone.Info.DeviceExtendedProperties.DeviceTotalMemory

Mobile In The Hand 7.0

Mobile In The Hand is a suite of components for developing mobile applications across Microsoft’s various mobile and embedded operating systems. It will save you development time and allow you to share more code across different .NET project types.

#    |
# Friday, April 15, 2011

Geocoding and Reverse Geocoding with Mobile In The Hand 7.0

This is the first in a series of posts about Mobile In The Hand 7.0 which brings a collection of reusable components to the .NET Compact Framework. This latest version is updated to support all versions of Windows Mobile including Windows Embedded Handheld, All versions of Windows Embedded Compact (in it’s various names) from 4.1 to 7.0 and a set of companion libraries offering a subset of the functionality on Windows Phone 7.

When the .NET Framework 4.0 was released it introduced a new namespace – System.Device.Location which provided a range of location features. Subsequently this was used as the model for Windows Phone’s APIs. One major whole in the Windows Phone implementation is that the CivicAddressResolver is not implemented and doesn’t return a result. Mobile In The Hand 7.0 comes to the rescue with a two pronged attack:-

An InTheHand.Device.Location.GeoCoordinateWatcher for the .NET Compact Framework. This uses the GPS Intermediate driver present on all Windows Mobile 5.0 and later devices and available as a system component on Windows CE 6.0 and beyond. This is exposed with a familiar object model which matches that found in .NET 4.0 and Silverlight for Windows Phone.

Secondly two new components are provided – BingCivicAddressResolver takes a GeoCoordinate and uses Bing Maps to resolve a CivicAddress object similar to the functionality available on desktop windows. Additionally as an extra feature the BingGeoCoordinateResolver allows you to resolve a GeoCoordinate from an address or partial address. Both of these classes are provided in the .NET Compact Framework and Silverlight for Windows Phone libraries which make up Mobile In The Hand 7.0. The Compact Framework version offers both Synchronous and Asynchronous calls, the Silverlight version just exposes the Asynchronous calls.

#    |
# Wednesday, April 06, 2011

Tasks: Coming in v1.7

This week we released the second in a couple of updates to the Tasks application. We’ve added a large number of features and improved compatibility with a wider range of servers based on user feedback. Let’s look first at compatibility – we now support Exchange 2003 and other ActiveSync 2.5 compatible servers. This includes your Hotmail To-do list! We received feedback that a lot of users still had Exchange 2003, one of the main reasons for this is that this was the last Exchange version to support a 32-bit OS and many people have 32-bit Windows Server 2003 and Small Business Server 2003 machines which they have no immediate plan to replace.

Trial Version

The next common piece of feedback was in the functionality of the Trial version. we’ve removed the restriction on the number of Tasks which the application will sync. Because the app used to synchronise the first 10 tasks these were rarely the latest and most useful tasks to have on your phone. The trial app is now limited to run for 7 days to let you evaluate the application.

New Features and Fixes

We have improved the logic behind our live tile so that it’s updates should appear in a more timely manner. When it receives an update it also uses your chosen accent colour:-

colour-tile

We’ve made numerous tweaks to the user interface within the application too. We also respect your theme colour throughout the application, and have added some new transition animations between pages which closely match the experience in the built-in Email and Calendar applications which Tasks is designed to complement. We’ve made category editing easier by using a picker control to easily select existing categories as well as support for adding new categories.

We’ve had support for editing Reminders on the phone in the last couple of versions but we’ve now added reminders within the application. When you launch the application it will display currently due reminders and others will pop up as they become due when you are using the application.

reminder

We’ve added support for completing recurring tasks and the application will show both the completed instance and the next task in the pattern (if applicable).

Thanks to feedback from several users we’ve also made improvements to the localised text – yes the application supports all Windows Phone languages (US English, UK English, French, German, Italian and Spanish).

We’ve also made numerous bug fixes and some performance improvements. There were some issues around sorting, specifically where several tasks had blank subjects, these are now resolved.

 

Exchange 2010 Synchronisation Fix

One issue we have encountered can be observed if the app shows “initializing…” and then immediately “synchronization failed” when you try to sync. This seems to be specific to Exchange 2010 and can be resolved by removing the device from your Exchange account using Outlook Web Access and then resetting synchronisation.  From OWA click Options and “See all options…” then select Phone in the left-hand list. You’ll see a list of mobile devices attached to your account. Your Windows Phone will have an entry and the Tasks application will have a separate one. To find the correct device select one and click Details. You can identify Tasks because it will show the user-agent as APPA-Mundi-Tasks/x.x.x.x where x.x.x.x is the version number.

owaproperties

Once you’ve identified the correct device delete it from the list, log out of OWA and from the Tasks application go to the Settings page and click Reset. The application can now setup a new sync relationship.

#    |
# Tuesday, April 05, 2011

Windows Phone 7: Localisation and Windows Phone Features

Anyone who has built an application for Windows Phone 7 in multiple languages will know there are three parts to the process. Within your application you can use managed RESX resource files to provide localised strings. For your application title or the initial text for your Live Tile you must use native resource dlls. Then when you are ready to submit your application to Marketplace you’ll need to provide descriptions, keywords and screenshots tailored for each supported language. At the moment there are six possible languages on the device side:-

  • English (United States)
  • English (United Kingdom)
  • French
  • German
  • Italian
  • Spanish

On Marketplace there are five languages – English (International) is used to cover both variants above. Even if your icon is standard across all languages you still have to submit it with each language as you upload to Marketplace.

There are several ways you can get your text translated, however one thing we noticed from experience is that certain features have established names in these different markets which may not equate to a direct translation from the English. Because the emulator and all retail Windows Phone 7 devices support all six languages you can easily change your device language and see how your application looks.

Feature names

For my future reference (and for yours) I’ve included a table below of some of these which may be useful. As I compile a list of more common words and commands I’ll add them to the table:-

English French German Italian Spanish
Start screen Écran Démarrer Startseite Start Screen Pantalla Inicio
Live Tiles vignettes dynamiques Live-Kacheln riquadri animati ventanas vivas
People Contacts Kontackte Contatti Contactos
Pictures Photos Bilder Foto imagenes
Games Jeux Spiele Giochi Juegos
Marketplace Marketplace Marketplace Marketplace Marketplace
Email E-mail E-Mail E-mail Correo electrónico

 

Common Controls

See also my previous post with localised resources for the Silverlight Toolkit which localises the Date/Time pickers and ToggleButton controls. This also works with the latest February release of the toolkit, simply use this destination folder:-

C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Feb11\Bin

The exception which proves the rule

Finally another observation which is specific to German. While the UI normally displays pivot headers and toolbar/menu text in lower-case this is not true for German where items should be capitalised.

#    |
# Tuesday, March 29, 2011

Windows Phone 7: More Tilt Effect

The Silverlight Toolkit for Windows Phone (Latest version is February 2011) contains a Tilt Effect implementation. To add it to your controls requires the addition of an XML namespace definition and one dependency propery set in your page XAML.

<phone:PhoneApplicationPage

…etc…
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    toolkit:TiltEffect.IsTiltEnabled="True">

 

However the implementation doesn’t apply the effect to all the same places as you will find it in the native application. So far I’ve identified the ListPicker and MenuItems within the ContextMenu control. You can add additional types to receive the Tilt effect and I’ve raised an issue in the CodePlex project so hopefully this will be addressed in the next update. In the meantime you can add the following to your App constructor:-

TiltEffect.TiltableItems.Add(typeof(ListPicker));
TiltEffect.TiltableItems.Add(typeof(MenuItem));

By itself I found that this didn’t actually fix the ContextMenu and the items do not tilt as they do in built in applications. However all is not lost! If you apply the property to each entry in your ContextMenu it does use the feature:-

<toolkit:ContextMenuService.ContextMenu>
   <toolkit:ContextMenu>
      <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled="true" Name="firstMenuItem" Header="edit" Click="FirstMenuItem_Click"/>
      <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled="true" Name="secondMenuItem" Header="delete" Click="SecondMenuItem_Click" />
   </toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>

Once you’ve done this you’ll have a context menu which behaves closer to the built in control. The Silverlight Toolkit is a great resource for additional controls and features which are not present in the Windows Phone 7 SDK. As always I’m eagerly awaiting the next update!

#    |