Author Archives: admin

New API in Windows Phone 8 GDR3

In this article I describe new developer APIs available in Windows Phone 8 GDR3/Update 3, at the time of writing this article the latest official version of Windows Phone OS.

First of all, GDR3 brings officially no new API, only minor changes in OS behavior, support for 1080p devices, devices with 2GB of RAM, couple of new Uri schemes and that’s basically it. But what you might have noticed last week, Pedro Lamas described in his article  Disabling screenshot functionality in a Windows Phone app one undocumented new property

  • PhoneApplicationPage.IsScreenCaptureEnabled

After reading that article I was wondering, if there are another new APIs available in the GDR3 update, that can be accessed by reflection, so I stared my analysis.

Continue reading

What to expect from Microsoft in 2014, Part 3. Xbox One

In my third article of what to expect from Microsoft in 2014, I’ll try to predict what we might see in the Xbox One ecosystem in the next year.

In my previous two articles about what to expect in 2014 in Windows Phone and Windows 8 I’ve already summarized my thoughts about these two platforms. I’ve been working with both these platforms for some time and I published already several nontrivial apps, but I’ve actually never written anything for any Xbox console (not counting my two XNA games for Windows Phone). I’ve also got my first Xbox 360 only about year ago, but the thing with Xbox One is different.

Let’s start first with the current status of Xbox One ecosystem. Xbox One was released just 1 month ago in November 2013 with about 20 games released at the start, including several exclusive titles. Right now there is no option available for Indie game or App development. Program for Indie game developers ID@Xbox was already announced and smaller game studios or even independent developers can apply with a chance to get dev kit “sometime in 2014”. All we know regarding this is probably on that page, nothing more. Note I’m not going to discuss the future of ID@Xbox program and indie game development on Xbox One in this article. I’m no game developer and as we know, the game development headed always in a bit different direction than app development on Windows, Phone and Xbox 360 platform.

Beside the ID@Xbox program, there nothing we know right now about possible indie App development for Xbox One. Although there are already some “major” apps on Xbox One, there is no public information how to create similar apps, even no information about used framework. As far as I know these are just modified web pages running on Xbox one with some private API for accessing Xbox One features.
Since the release of Xbox One there were only some rumors about possible indie app development, but just couple of days ago Microsoft announced the new Build 2014 conference in April 2014 and here is why I think we might get similar app Store on Xbox One just like we have on Windows 8.1 today…

Continue reading

What to expect from Microsoft in 2014, Part 2. Windows 8.x

In my second article of what to expect from Microsoft in 2014, I have gathered my thoughts on another popular platform – Windows 8 and Windows Store apps. My first article about Windows Phone in 2014 is here.

Just two months ago we’ve received the free Windows 8.1 update to all current Windows 8 installations, codenamed “Blue”, almost exactly one year since the original Windows 8 release. This update fixed lot of quite annoying bugs when developing “Modern apps”, added new tile sizes, various app widths, multi-monitor support, improved the sync between devices, added native SkyDrive integration, brought IE11 and also lof fixes and improvements under the cover. But since then there is no future plan of this platform. I guess it’s quite early to predict any actual development in 2014, but let’s do it anyway…

Continue reading

What to expect from Microsoft in 2014, Part 1. Windows Phone

In my first article of what to expect from Microsoft in 2014, I’ll gather my thoughts regarding the Windows Phone platform.
As we already know, there was no major update of WP platform in 2013. The last major update was WP8 in November 2012 and since then we have only seen minor updates called GDR1,2 and 3, or in Microsoft terms Update 1,2 and 3. These brought some small fixes and features asked by users + support for quad-core ad FullHD devices, but overall nothing breathtaking.

The year 2014 will be different. We can say almost for sure, that Microsoft will deliver the long awaited update with codename “Blue” and expected name Windows Phone 8.1. This update might be first mentioned on Mobile World Congress in February and maybe delivered as a beta version shortly after, or no later than after the BUILD 2014 conference in the early April 2014. Similarly to WP7.5 “Mango” that Microsoft delivered in 2011, WP8.1 should be available to all existing WP8 devices.

Beside WP8.1 we won’t see most likely anything new that year, maybe only some kind of GDR5 update filling the gaps and bugs in not yet fully polished WP8.1 RTM version.

What to expect in WP8.1 from user’s perspective?

This is my personal list of user features that we might expect in this update, sorted by my subjective probability.

Continue reading

Tip: hiding programatically the “volume bar” controls on Windows Phone 8

windows-phone-volume-bar

Just a simple tip, what I just discovered recently – you probably know that when you play any music file or tune FM radio station on Windows Phone 8, this volume bar controls appear, when you press Volume Up/Down buttons. But even when you stop the music playback, there is no simple way, how to remove this media playback bar.

But since there is already at least one app, that can remove this Volume bar, I was wondering, how to do it in C# as well.

After couple of minutes tinkering with the MediaPlayer class I’ve discovered the solution, and it’s pretty easy:

  • You need to add into your app empty file with .wma extension and set the build action as “Content”, for instance “empty.wma” into the app root folder.
  • To stop the media playback and remove the media player just create dummy Song object and try to play it like this:
Song s = Song.FromUri("empty", new Uri("empty.wma", UriKind.Relative));
MediaPlayer.Play(s);

And that’s all 🙂
Note I’ve tested this only on Windows Phone 8 device with GDR3 update, but I guess it will work on WP7.5 as well.

How to debug most common memory leaks on WP8

When developing Windows Phone application, which is more complex than just 3 screens and couple lines of text, you’ll probably face the well-known problems of memory leaks. Even when using modern platform as Windows Phone 8, without pointers, with Garbage Collector, IntelliSense and everything, it is still quite easy to experience memory leaks in your apps.

In this article I’ll go through 3 most common problems that are causing leaks when developing Windows Phone apps: Images, abandoned Pages and leaks in native controls. I’ll also shown you simple trick, how to find your leaks early in the development and not two weeks before project deadline 🙂

Continue reading

Shared localization for Windows Phone 8 and Windows 8 apps using Portable Class Libraries

When developing Windows Phone 8 or Windows 8 app for more wider audience, you need to think about the localization. Unfortunately the localization on each platform uses completely different approach:

On Windows Phone 8:

  • Standard resx files with strings for each language are used.
  • The default language, for instance “en”, has localization in file without any suffix, typically just AppResources.resx.
  • Other languages uses files with culture specific suffix, like AppResources.de.resx, AppResources.cs.resx, etc.
  • For supporting non-default languages it’s required to check the additional languages in WMAppManifest.xml file and in the project settings as well
  • Localization in XAML is done typically via databinding to viewmodel class, that has instance of AppResources class, typically:
  • <TextBlock Text=”{Binding Loc.AppTitle, Source={StaticResource Localization}}“/>
  • in AppResources.resx:   |   AppTitle   |   Hello world!   |
  • For accessing the localized string programatically you can use:
  • string text = AppResources.AppTitle;
  • Globalization and localization for Windows Phone

On Windows 8(.1)

  • Windows 8 uses for localization new file types ending with .resw, but actually they use completely equal structure as WP8 .resx files.
  • Each file must be placed in a separate folder, for instance English localization should be placed in Strings/en/Resources.resw, German localization in Strings/de/Resources.resw
  • There are no automatically generated Designer.cs files for these resw files, but you can create manually ResourceLoader class for returning localized strings.
  • In Windows 8 the localization of Controls in XAML is done differently. Rather than assigning directly values using databinding, you just name each localizable control with x:Uid property and then add entry for localizing such property directly into resw file:
  • <TextBlock x:Uid=”TextBlock1″ Text=”DesignTimeText”/>
  • in AppResources.resw:   |   TextBlock1.Text   |   Hello world!   |
  • For accessing the localized string programatically you can use:
  • ResourceLoader resourceLoader = new ResourceLoader();
    string text = resourceLoader.GetString(“TextBlock1.Text”);
  • Application resources and localization sample (Windows 8.1)

As you can see, the recommended localization uses completely different approach in Windows Phone 8 and Windows 8. Sharing resx files using links, or even copying them or renaming is just not feasible to maintain. Beside these obvious differences, there are even other caveats:

  • Accessing localized strings in Windows 8 projects programatically is really cumbersome and you can make simply error, because you have no direct compile time check, that “TextBlock1.Text” actually exists in the resw file.
  • You cannot share any localized XAML code between Windows Phone 8 and Windows 8, because of the different localization method

Let’s see, how to solve this mess once and for all

Continue reading

Pro WP8 AppBar management with AppBarUtils

When developing apps for Windows Phone 8, every developer needs to know how to create and manage the App Bar. The problem is you cannot use databindings and/or localization in App bar buttons and menu items, you also cannot bind the colors or enabled state or even use commands bound to the buttons.

Most apps I’ve seen uses tedious programmatic initialization in code, repetitive entering of same resource values, or even not localized App bar at all. But there is an easy solution – the AppBarUtils library.

With this library you can use databinding for all AppBar properties, use Commands, even use dynamic app bar content for currently selected pivot/panorama item or your own state like logged-in/logged-out user. Let’s see, how to do it.

Continue reading

Windows 8 Share Task out-of-sandbox vulnerability

When I was recently developing one Windows 8 app that supports the “Share Contract“, I’ve experienced strange problems when the sharing suddenly stopped working not just in my app, but for all apps launched from my account. I had to log-off and log- in to make it work again. I thought it was just some kind of temporary issue until I discovered that it cause my app. After hour of testing I’ve pinpointed the actual issue and came to conclusion:

Any Windows 8 app running in sandbox can break the Share Contract for ALL other Windows 8 apps running under the same account, until the user logs off and on again!

Here’s the detailed explanation how to do it, it’s quite simple, nothing tricky.

Continue reading

Image path databinding in WP8 and Windows 8 apps

I don’t like lengthy articles, so let’s make it short and easy.
When you are developing Windows Phone 8 or Windows 8 “modern” apps, you surely want to display images in it.
For displaying images the well known Image element is used:

<Image Source="imagepath"/>

The imagepath can have multiple values, it can be:

  • Uri address to image located on the Internet
  • path to image located in app resources/app installation package
  • path to image located in app isolated storage

The interesting point is that I’ve discovered only today that it is actually possible in WP8 apps to display images located in isolated storage directly just by defining the Source, without any loading to Stream and BitmapSource. That’s right, even if you search on StackOverflow or on MSDN  how to display images located in isolated storage using path in WP8, they tell you it’s not possible.

Yes, it is possible, and the whole magic it so use absolute image path using the StorageFile.Path property. Now you know the secret, but let’s check it in detail.

Continue reading