Windows Phone 8.1 apps/multitasking FAQ

Published by at

A little knowledge is a dangerous thing, it seems, and my attempt at simplifying the situation in terms of applications and Windows Phone 8.1 multitasking/optimisation was rightly picked at by a number of developers, who live and breathe this stuff. So I got in touch with one of them, Sarah Fegert, and asked some of the more pertinent FAQ-style questions....

[My questions to Sarah, obviously, are in bold]

I gather there's no one single 'type' of Windows Phone application - how many ways are there to develop for the platform?

SarahQuite a few! Most Windows Phone 7 and 8 apps were developed using a framework called "Silverlight". What Microsoft has been doing over the last years is gradually converge the development tools and app types of Windows RT and Windows Phone into a single one. These new apps are called "Store" apps, and allow developers to write apps that run on both Windows and Windows Phone.

But to keep developers with existing apps happy, Microsoft also introduced "Silverlight 8.1", essentially a turbocharged Silverlight, allowing existing Windows Phone apps to use most of the new features in Windows Phone 8.1.

What difference has it made for developers having Windows Phone 8.1 arrive? And, overall, is it an improvement (for developers)?

8.1 has been an incredible step forward. Windows Phone 8.0 was very restricted in what developers could do. Just one example: Most fitness trackers and smart gadgets use a technique called Bluetooth Smart to connect with your phone with minimal battery drain. Bluetooth Smart wasn't available in Windows Phone 8, even though iOS and Android had it for years. So, Windows Phone 8.1 introduced a number of features that developers had demanded for a long time - features that often were available on competing platforms. Many of the new apps we've been seeing over the last weeks (FitBit, Hotel Tonight, Files, etc.) are a direct result of giving developers these tools.

My recent piece bemoaning imperfect application resumption got people talking. These being multi-GHz devices, what's stopping every application from being quick to start and/or resume? What showstoppers are in the way?

The fundamental constraint is memory (RAM). To load an app and render the UI, the operating system needs to allocate some memory for the app, typically between 50-100 MB. When you leave an app (but don't close it), the app stops doing anything, but remains in memory, and as long as it remains in memory, it resumes instantly when you switch back to it. What happens when you use too many apps is that the operating system would eventually run out of memory, and to prevent that from happening, it selects one or more of the suspended apps and shuts them down, freeing memory. This process is usually called tombstoning on Windows Phone. Now, obviously, tombstoned apps aren't in memory anymore - so next time you switch back to them, the OS needs to reload the app and restore the previous state. When that happens, the user sees the dreaded "resuming..." screen. There is not really much that developers can do to prevent this from happening.

Even on the 2GB Lumia 1020, 1520, Icon and 930, just as many apps seem to end up being 'resumed' as on the lower RAM devices. Is Windows Phone 8.1 perhaps not using all the RAM efficiently? Is there some kind of 'no go' area, reserved for system or imaging use?

There are a few things to consider here actually. Firstly, because these devices have  much higher screen-resolutions, apps require more RAM. The exact factor varies between apps, but, for example, rendering a full-screen, full-resolution image on a 1520 uses 6x as much RAM as rendering a full-screen, full-resolution image on the 630. Secondly, as you say, some of the memory is reserved for system use. Thirdly, the performance of the storage (internal or SD card) may also affect how long an app takes to resume. 

Subjectively, I see less resuming screens on my 1520 than on other devices - and seeing how fluid the user experience is on my 630, Microsoft has done an excellent job optimizing resource usage, in particular if you look at how badly Android runs on low-end devices.
 
On these quad core multi-GHz devices, why does resuming (reloading from tombstoned state) take so long? I'd have thought reloading a (say) 50MB footprint app from internal flash memory would take well under a second, yet some apps (Skype, Twitter) seem to take much, much longer. Is this the fault of the apps or current limitations in the OS?

How fast apps resume would mostly depend on the specs of the phone. When apps are at fault, it's usually down to not rendering a screen to the user until they've loaded some data from the internet or local storage. Developers can use a number of solutions to avoid this problem.

Anecdotally, I've never ever had Twitter 'resuming' for more than one second, from a Lumia 520 all the way to a 1520. Usually it's less than half a second. I wonder if there's a bug somewhere...)

Do Microsoft's own applications have any special privileges, or are they in the same boat as third party apps?

They certainly do - the operating system decides which app gets shut down when the phone is low on memory. Since users are very likely to use the Start Screen or the Email app, the operating system would typically try to shut down other apps first.

AppCauldronBy the way, this is another area where the update to Windows Phone 8.1 really changed things. Apps used to have a fixed amount of RAM allocated - typically 150 MB - even if the app used only a fraction of that. Now, the memory allocated is much closer to what the app actually uses. In theory, this should improve multitasking. For example, on Windows Phone 8.0 when our users took a picture during their run on a low memory device, Track Runner would be tombstoned and the run interrupted. This is no longer an issue with the new memory allocation of WP 8.1.  

What's your view on transitions? Do you think Microsoft should offer a way to disable them, to speed up the WP UI?

Microsoft says that transitions don't slow down the UI, and this matches my personal experience. Within the app, transitions are optional but they make up much of the Windows Phone feel, so apps without transitions feel rather alien to the platform.

_________________

Many thanks to Sarah Fegert, one of the co-founders of The App Cauldron, Inc, the development team behind the award-winning WP-exclusive running app Track Runner.

PS. I'd add one huge tip, borne of experience. Even on Windows Phone 8.1, it's still often much faster and smoother to use the multitasking carousel (long press 'back') than to tap on a live tile or on an application in the main app list. Accessing via the view in the carousel seems to bring up the application exactly as-is (as long as it's still in RAM), while even with all the 'fast resume' code in the app and under 8.1, there's usually some resuming or reloading behaviour if you go via a tile or icon. 

Comments?