Windows Phone 8 developer platform highlights

Earlier this week, at the //BUILD 2012 conference, we announced the Windows Phone 8 developer platform, the most significant enhancement to our dev platform to date.  Built on a common core shared with Windows 8, the dev platform is all new – from the underlying subsystems to the APIs and tools.   Because so much has changed, I wanted to take a moment to touch on the highlights.  Each section provides a short overview and links to additional detail to help you quickly navigate our all-new document library.

I encourage you to visit the Dev Center to download the new SDK and register for a local Dev Camp event to secure time with our experts to learn more.  If you’re new to Windows Phone or just getting started, you’ll want to register for a new Individual Account by November 7 for just $8 (U.S.), a savings of $91. See the Dev Center for additional details.

Please give us your feedback here or at #wpdev.

C++

By popular demand, we’ve added the ability to use C++ in your apps.  Mobile developers need to build for multiple platforms and C++ is the code portability standard, both for business logic and for open source libraries like SQLite.  In Windows Phone 8, you can now use C++ in your XAML-based C# or Visual Basic.NET apps – or you can write an entire app in pure C++ using our brand new native app model.

Introducing Direct3D app

In Windows Phone 8 we have a new gaming platform for C++ developers: Direct3D app.  This new app model gives developers low-level access to Direct3D APIs for graphics, XAudio2, and WASAPI for audio as well as a host of other needed C++ APIs for game development.  Even better, it is the same app model you’ll find in Windows 8 – so not only is it easy to bring C++ games to Windows Phones, but it’s also very easy to target Windows 8 at the same time!  Our new C++ gaming platform has also made it easy for popular game engines and middleware, such as Unity3D, Havok, FMOD, Audiokinetic Wwise, and Autodesk Scaleform to target Windows Phone, and all of these will soon be available for Windows Phone 8. For more info about the native Direct3D app model and the features available to this type of app, see Direct3D app development for Windows Phone 8.

New and expansive Windows 8 aligned APIs

Windows Phone 8 is built on a shared core with Windows 8, and as part of that shared core we are introducing a new expansive Windows 8 aligned API that makes it easy to write apps that target both Windows 8 and Windows Phone 8 apps.  This new API surface is primarily built using the new Windows Runtime style APIs (which are available to both C#/Visual Basic.NET code and C++) and also includes COM and Win32 APIs.  

XAML app improvements

We have evolved and improved our XAML app model in a significant way to make it very powerful and enable many new scenarios.  The following sections cover the highlights.

XAML control improvements

It’s now easier than ever to create visually responsive, beautiful, and consistent apps with a number of improvements to XAML controls.

  • LongListSelector control
    The LongListSelector control gives you access to all the Windows Phone list experiences: grouping with sticky headers, jump list support for easy navigation, a grid view for thumbnail layouts, and events to simplify the creation of infinite scrolling scenarios. For more info, see LongListSelector control.
  • Map control
    Built on top of the Nokia mapping engine, the Map control for Windows Phone 8 has been rewritten from the ground up to provide support for off-line maps, independent input handling for smooth panning, and vector-based data for clear, concise maps regardless of zoom level or mapping mode. For more info about the new Map control, see Maps and navigation for Windows Phone 8.
  • WebBrowser control
    The WebBrowser control enables rich CSS3-styled content powered by HTML5, and it’s hardware-accelerated for a cutting edge performance. For more info, see WebBrowser control.
  • Control performance
    Panning and flicking is more responsive and uses less memory with the improved Panorama, Pivot, and LongListSelector controls. Standard Panorama usage now consumes 50% less memory than before. Other controls have also received performance improvements, for example ProgressBar now renders on a separate thread ensuring it animates smoothly regardless of what else is happening in the app. For more info, see the Pivot, Panorama, and ProgressBar controls.

Windows Runtime Components

XAML apps and Direct3D apps can build reusable Windows Runtime Components using C++. These components can provide APIs that are directly callable from C++ or C#/Visual Basic code.

C++ code reuse

XAML developers can now reuse C++ in their apps.  This enables a whole new set of options, from using open source C/C++ code such as SQLite, to reusing C++ app code, to calling new COM and Win32 APIs in the Windows 8 Aligned API surface.

XAML and Direct3D

Windows Phone 8 introduces two new elements that enable XAML developers to render part of their app directly from Direct3D using C++. 

<DrawingSurface/>

DrawingSurface positions a Direct3D surface within a XAML app along with other XAML elements.  This is useful when you want to render a small ‘island of Direct3D’ and have it automatically composited with other elements.

<DrawingSurfaceBackgroundGrid/>

DrawingSurfaceBackgroundGrid is a very special element that must always be the root element of a page and allows developers to render directly to the background from Direct3D using C++.  DrawingSurfaceBackgroundGrid, as its name implies, inherits from Grid so you can position child elements using Grid layout.  The child elements are automatically composed by the platform on top of the Direct3D rendered background.  DrawingSurfaceBackgroundGrid allows developers to render directly, instead of requiring a copy (through a Direct3D swap chain) like DrawingSurface requires, which results in faster performance.  DrawingSurfaceBackgroundGrid was introduced to support games or other apps that require ‘to the metal’ graphics performance, but also want to use existing XAML elements for UI and have access to some features not available in the native app model like Live Tiles or Notifications.

Text improvements

We’ve added full support for right-to-left (RTL) languages. Mixing languages isn’t a problem either as XAML supports bi-directional text, allowing both left-to-right and right-to-left text in the same sentence. Regardless of the text being rendered, it will be more consistent across apps now that the XAML text stack has been rewritten to use the same DWrite-based rendering system that powers the rest of the phone as well as Windows 8. For more info, see Creating bidirectional apps for Windows Phone 8.

New gesture support

Pinch and stretch data is now available inside the Manipulation series of touch events making it easier to create accurate and responsive two-finger scaling experiences. For more info, see Gesture support for Windows Phone.

Multi-res support

Windows Phone 8 supports new high-resolution displays, adding WXGA (768 x 1280) and 720p (720 x 1280) to the existing WVGA (480 x 800) from previous releases. Our commitment to supporting existing apps includes helping to ensure your current apps will “just work” in these new resolutions, with the phone doing the work of scaling and matting the applications to fill the screen. New apps can take advantage of the higher resolutions by including high-fidelity assets, while maintaining a single, common layout due to the use of logical pixels rather than physical pixels. And as always, game developers are free to choose the resolution that best supports their experience and rely on the high-quality scaler hardware to make it fill the screen. Finally, Visual Studio includes new emulators that make it easy to test all three resolutions even if you only have a single phone. For more info, see Multi-resolution apps for Windows Phone 8.

Networking improvements

Windows Phone 8 drastically expands the networking options available to developers.

  • We’ve added Windows 8-aligned Windows Runtime sockets support, allowing developers to write networking code that can be shared across Windows 8 and Windows Phone 8. This API surface allows use of StreamSocket (for TCP) and DatagramSocket (for UDP) and offers a rich object model for solving socket programming needs, including listening on a socket.
  • We’ve also added Windows Runtime APIs that support both Bluetooth and NFC proximity scenarios. These APIs support both app to app and app to device. For app to device, you can now connect your app to devices like the AR.Drone Quadcopter or Sphero. App to app enables socket-based communication between two instances of your app running on different phones, which enables exciting gaming and data sharing scenarios.
  • We’ve improved our .NET socket support to include listening on a socket which enables peer-to-peer connections.
  • In addition to our .NET HTTP support, we’ve also added C++/COM based support for HTTP. Both APIs also support HTTPS.
  • Winsock support has been added to Windows Phone 8 allowing porting of legacy networking C/C++ code.

App performance

We’ve made it possible for all apps run faster (even those built for Windows Phone 7.5) by enabling some key improvements:

  • Compile in the cloud
    Apps start dramatically faster because we now compile app assemblies to a native image in the cloud before they are installed or run on a phone. This eliminates the need to JIT compile during startup or whenever a new assembly is loaded.
  • Startup splash screen
    Work has been done to make the splash screen experience work more smoothly. For apps that have a splash screen, users will notice an immediate transition to the splash screen after the tile animation fade-out. For new apps, the default Visual Studio project template no longer contains a splash screen due to the improved startup speed.
  • Binary XAML
    To further improve the app launch experience, app XAML is compiled to a binary format during app installation. This allows app startup to skip expensive string parsing, resulting in faster app launches.
  • Off-thread input
    Starting with Windows Phone 7.5, the ListBox control handled user input on a different low latency thread, resulting in more responsive input. With Windows Phone 8 we have expanded off-thread input to Panorama, Pivot, and our new LongListSelector control. Developers can also leverage off-thread input in their own controls to create more responsive experiences.

Camera and Lenses

Lenses are camera-based apps that work with the built-in camera and enable new types of rich media experiences in the Camera Roll.  With the addition of Windows Runtime APIs for capture, deeper control of the camera sensor is possible and can enable new types of image processing when used in combination with the ability to reuse C++ code.  There are also more places to work better together with the phone, including creating auto-upload agents, photo editors, and the new ShareMediaTask for sharing to the cloud. For more info about Lenses, see Lenses for Windows Phone 8. For more info about ShareMediaTask class, see How to use the share media task for Windows Phone.

Wallet

The Wallet Hub enables users to organize the digital versions of their payment cards, loyalty and membership cards, tickets, boarding passes, and deals and coupons.  Wallet has an extensibility model that allows apps to provide and update Wallet content. Like Live Tiles, it’s an additional surface area for your app to reach users even if they haven’t launched your app. Wallet Agents help ensure that your content is always up to date. Secure NFC will be supported in some markets, allowing your Wallet items to be used for secure transactions. For more information about wallet, see Wallet for Windows Phone 8.

In-app purchasing

Microsoft has engaged with commerce providers from 191 countries/regions around the world to bring you new ways to sell digital goods within your app. You can sell durable goods like avatar items, eBooks, and additional game levels, or consumable goods such video rentals or virtual currency in your apps (such as gold coins, or poker chips).

Users can make in-app purchases the same way they buy apps, using credit cards, PayPal, and our most-popular option: mobile operator billing. Microsoft provides electronic proof of purchase for every purchase so that you can identify each purchase uniquely, including who made it, when, and how much they paid in your app or on your server.

Revenue share pricing and terms are the same for in-app purchases as they are for app purchases. Our full policies are available here. For more information about in-app purchasing, see In-app purchase for Windows Phone 8.

App-to-app communication

Windows Phone 8 allows apps to register custom URIs and file type associations, so they can work better together.

  • You can register a custom URI scheme for your app to enable other apps to launch it. Even built-in apps like messaging, email, and the browser can launch your app when they encounter your URI scheme. Your app can also be launched in response to proximity-based connections like NFC. In addition, you can launch other apps from your app using their custom URI scheme, which enables scenarios like initiating a Skype call from your app.
  • Your app can register with the system so that it can be associated with different files types. When other apps or the built-in apps invoke a file with an extension associated with your app, your app will be loaded to handle it. Your app can also invoke files such as Microsoft Office files and PDF documents and the built-in features of Windows Phone 8 will load to handle them.

Best of all, you never have to worry about whether users have your app installed to handle a given URI scheme or file type. If your URI scheme or file type is invoked and your app isn’t installed, the phone will launch the Windows Phone Store and inform users they need to install your app to complete their task.

Lock notifications, wallpaper and new Live Tile support

Windows Phone 8 increases the opportunities for developers in notifications and Tiles.

  • Live Tiles are the heart and soul of Windows Phone and we wanted to give developers more ways to be part of the iconic Windows Phone experience. We’ve added 3 new Live Tile templates (Flip, Cycle, and Iconic) and added two new Live Tile sizes (small and wide). And we’ve enabled apps compiled for 7.1 (Windows Phone 7.5 OS) to “light up” when they’re running on Windows Phone 8 (more in a blog post soon).
  • Users can now add notifications from your apps to the lock screen.
  • You can enable your app to provide lock screen backgrounds, and users can then configure your app to provide them.

For more info, see Tiles and notifications for Windows Phone and Lock screen for Windows Phone 8.

Speech

Windows Phone 8 includes a full-featured speech platform that allows users to launch and talk to their apps.

  • Voice commands
    Launch an app and automatically execute a command.
  • APIs for in-app dialog
    Customize apps to allow dialog and spoken commands.
  • Text-to-speech
    Developers can now use text-to-speech APIs to enable their apps to give verbal feedback and notifications.

These APIs allow the use of both on-device voice recognition for local grammar and web-based voice recognition for dictation, powered by Bing. For more info, see Speech for Windows Phone 8.

VoIP platform

Windows Phone 8 introduces new platform features to enable VoIP providers to deeply integrate with the Windows Phone experience. We have enabled enhanced push notifications and opened up the incoming call notification so that VoIP providers can build experiences that look like regular incoming phone calls, including continuing to run in the background if the user launches a different app. These new APIs support video calls in addition to audio calls. For more info, see VoIP apps for Windows Phone 8.

Enterprise app support

Windows Phone 8 allows companies to enroll and manage phones.

  • Enroll your phone with an enterprise via the new “company apps” settings app.
  • Companies can help keep the phone and company assets secure by pushing policies to a phone after it is enrolled. For example, an enterprise can require a PIN code be set or can turn on BitLocker to keep the phone’s content encrypted.
  • Companies can remotely delete just their company data, without wiping the entire content of an individual phone.

Windows Phone 8 allows companies to distribute their apps to their employees, privately and in a security-enhanced way.

  • Companies can enroll the phones they choose and only these phones can get access to their enterprise apps.
  • Companies can package and sign their own apps. These apps can be launched and run only on phones enrolled with that enterprise.
  • Companies can build their own Company Hub – a one-stop place that gives users access to everything about their company. Some of the features that a company can include in their app are the ability to discover and install enterprise applications from the “company store”, and enumerate and launch enterprise apps already installed on that phone.

Contacts and calendar

Windows Phone 7.1 introduced read-only Contact and Calendar APIs, enabling apps to bring together users’ contact and calendar information. Windows Phone 8 takes this a step further by allowing apps to create their own read-write contact stores on the phone and to have those contacts aggregated into the People Hub. Even better, apps can optionally make these contact stores visible to other apps.

Apps can now add appointments to the user’s calendar in addition to the existing app-specific reminders functionality. For more info, see Contacts and Calendar for Windows Phone.

Fast application resume

In Windows Phone 7, a new instance of an app was always started when the user launched the app from Start or the App List, even if the app was already in memory. In Windows Phone 8, the app developer gets to choose either the default re-launch behavior or the new “Fast Resume” option, which simply resumes the existing app instance if it is suspended in the background. Apps that take advantage of the new “Fast Resume” option still exhibit the default “first page” resume user experience by default. For more info, see Fast app resume for Windows Phone 8.

Location aware apps

We’ve added new multitasking capabilities to enable apps to continuously track the user’s location (with their permission, of course). This enables apps like navigation and run-tracker apps to run in the background even after the user switches to another app and can issue voice and audio from the background, show toast messages, or even update its Live Tile on Start. For more info, see Location for Windows Phone 8.