A Background on Windows Phone 8's New Map Services
One of the anticipated new features of Windows Phone 8 (WP8) is the improved support for full app multitasking. Adina Trufinescu, a Program Manager on the Windows Phone Developer Platform discussed the improvements as part of her larger presentation about the changes made to the WP8's maps and location services.
WP8 developers can now utilize the Windows Phone Location Service API which is composed of two API groups. The set of first set is based on the Windows Runtime API from Windows 8 combined with Phone specific additions. The second is the Windows Phone Runtime API which addresses phone specific features such as speech and VoIP.
After introducing the APIs, Trufinescu provided some general tips for writing apps requiring location/map services:
- Make a single location request when you can
- Leverage caching for faster results
- Find the right tradeoff between accuracy and timeout
- Is wifi on? If not, ask user to turn it on as it is more accurate than GPS in urban canyons
Windows Phone 8 Map Control
The new WP8 Map Control provides the following features:
- Nokia Mapping Data: over 100 countries
- Offline Maps – Allows users to download maps, MapDownloaderTask exposes download and update to developers
- Map Control – smooth interactions, lag-less overlays, rotation, pitch
- Route Display – easy to route calculated via Map Services
The Map Control is not a pure NET control, it is a hybrid constructed from .NET and native code. Native code is used to do the “heavy lifting”. The development team made a trade off between the developer experience and the user experience, in this case slightly skewing in favor of the user. As a result, when designing the layout of the WP8 screen in Visual Studio the control's presence will be marked by a placeholder icon.
Mike O'Malley, Program Manager, joined the presentation to demonstrate the new code in action. He noted that the new control requires the use of different developer credentials than the Bing maps based controls, which means WP8 developers should use their dev.windowsphone.com credentials. The Windows Phone 7.X Map API (Bing Maps Control / Bing Maps Task) is still available and should be used for 7.X-based apps, but their use is deprecated for WP8 apps.
WP7.5 introduced multitasking but it was limited as it left out support for apps using Location and VOIP features. This absence has now been corrected with WP8, but there are a few constraints:
- XAML apps only
- A single location Tracking app can run in the background
- Apps runs with limited access to resources
To preserve the quality the of the user experience, background apps are limited to 10% of the CPU usage, and they cannot access the camera or microphone (for security/privacy reasons).
WP8 also introduces Fast Resume which is available to any WP8-based app that opts into this model. A change to the app's manifest setting will allow Fast Resume. Apps supporting this have the following operational behavior:
- Resume previous experience for Primary tile, when previously launched via Primary tile
- Start fresh for Deep Links, when previously launched via Primary tile or a different Deep Link
- Don't block OnBackKeyPress, this is how users close your app
Mike Amundsen May 29, 2015
Ben Linders May 28, 2015