Quantcast
Channel: Building Apps for Windows
Viewing all 623 articles
Browse latest View live

New sensor features in Windows 10

$
0
0

This blog was written by Rinku Sreedhar, Senior Program Manager

In Windows 10 we added multiple new sensor features, innovations and changes. In my previous blog, I talked about the new contextual sensing features like activity sensors, pedometers, barometer and proximity sensors. In this post, I will give an overview of three additional sensor features in Windows 10: sensor batching, ReadingTransform and custom sensors.

Sensor batching

If you have been trying to create an app for sleep monitoring but are concerned about the power impacts, here is a solution for you. In Windows 10 we introduced Sensor Batching for accelerometer. What is Sensor Batching? It is a sensor that implements batching capable of buffering sensor samples in sensor hardware and delivering them in a batch instead of delivering continuously. This allows the application processor to save power as it can wake-up less frequently to receive sensor samples together in a batch rather than stay awake to process samples at data intervals.

The diagram below shows how data is collected and then delivered, both continuous delivery as well as batched delivery.

1_sensorBatch

With batching, accelerometer now has 2 additional properties:

  1. MaxBatchSize : The maximum number of events that the sensor can cache before it is forced to send them. If this is zero, then batching is not supported by the sensor. The actual size may be smaller than this number size since the batch FIFO can be shared by multiple sensors.
  2. ReportLatency: This will allow an application to influence how often the sensor sends batches by adjusting the latency. When this property is set for an application, the sensor will send data after the specified amount of time. You can control how much data is accumulated over a given latency by setting the ReportInterval property. Setting this is optional for applications and also optional for sensors to support.

Key points to note:

  • Batching is recommended when the workflow is mostly happening in the background, with limited interactions in the foreground / on-screen.
  • Maximum ReportLatency = MaxBatchsize * ReportInterval. If you specify a higher value than this, then the maximum report latency will used so you do not lose data.
  • If MaxBatchsize = zero, then Batching is not supported by the Sensor.
  • Multiple application may set a desired latency, in this case shortest latency period will be used.

API Pattern is as shown below:

// Select a report interval and report latency that is both suitable for the purposes of the app and supported by the sensor.
// This value will be used later to activate the sensor.
uint32 minReportInterval = accelerometer->MinimumReportInterval;
desiredReportInterval = minReportInterval > 16 ? minReportInterval : 16;

// MaxBatchSize will be 0 if the accelerometer does not support batching.
uint32 maxSupportedLatency = desiredReportInterval * accelerometer->MaxBatchSize;
desiredReportLatency = maxSupportedLatency < 10000 ? maxSupportedLatency : 10000;

// Establish the report interval
accelerometer->ReportInterval = desiredReportInterval;

// Establish the report latency. This is a no-op if the accelerometer does not support batching
accelerometer->ReportLatency = desiredReportLatency;

More detailed API reference for Accelerometer with the new properties introduced for Batching can be found here and UWP SDK Samples can be found here.

ReadingTransform

Were you ever frustrated with aligning your app to the display orientation you wanted? it’s now very easy for you to do with a one line code change with Windows 10 UWP APIs.

Here’s more information and a bit of a background on this. Windows desktop and Windows Phone define their sensor coordinate systems differently – due to this, you were required to write extensive code to transform the sensor data coordinates with the display orientation.

Most sensor’s (like accelerometer, gyroscope, magnetometer etc.) data comprises the readings in X, Y and Z axes, which depends on the way the sensor was integrated to the system.

All landscape-first devices integrate sensors in such a way that their X-axis is along the longer edge and Y-axis is along the shorter edge of the device. Z-axis is perpendicular to the display.

2_landscapeFamily

However, all portrait-first devices integrate the sensors in such a way that their X-axis is along the shorter edge and Y-axis is along the longer edge of the device. Z-axis remains perpendicular to the display.

3_portaitFamily

This made it quite complex to have your app run on multiple devices as you were required to transform the sensor data to the required display orientation. In Windows 10, we added a new property called ReadingTransform that allows you to specify the display orientation you want to align the Sensor data.

Now it’s easy to do the following:

  • To have your UWP apps align with the display orientation you specify to get it work across the entire family of Windows 10 devices, including desktop, phone and Xbox, HoloLens, SurfaceHub and IoT.
  • To convert your existing desktop or Phone app to a UWP app that will work across multiple device families.

Here is the C++ sample code change required to make this happen, using accelerometer as an example:

void Scenario4_OrientationChanged::OnOrientationChanged(Windows::Graphics::Display::DisplayInformation ^sender, Platform::Object ^args)
{
    if (nullptr != accelerometer)
    {
        accelerometer->ReadingTransform = sender->CurrentOrientation;
    }
}

For more info, here is the complete sample on Github

Few key points to note:

Custom Sensors

Starting Windows 10, hardware manufacturers have the ability to add new sensor types that don’t have a first class representation , for example air quality sensor, temperature sensor, heart rate sensors etc. Custom sensors provide a generic API through which IHVs can expose any type of sensors and release them independent of Microsoft’s OS ship cycle.  Partners who used the Win32 sensors API for custom sensors can now develop Windows Store apps without modifying their hardware, and without the complexity of using low-level HID.

Key points to note:

  • Added a new namespace Windows.Devices.Sensors.Custom for Custom Sensors.
  • Defined the new CustomSensor, CustomSensorReadingChangeEventArgs and CustomSensorReading classes modeled very similar to the other sensor classes (Accelerometer, Gyroscope, Magnetometer…).
  • The CustomSensorReading class contains a list property of key/value pairs that contain the custom data sent from the sensor’s driver to UWP app (key is a string representing a PROPERTYKEY, values can be integers, Booleans, floats or double) .
  • The CustomSensor class reuses the same eventing mechanisms as the other native sensor classes.
  • The CustomSensor class also reuses the same common properties (DeviceId, ReportInterval) as for the other native sensor classes.

API Pattern is as shown below:

// The following ID is defined by vendors and is unique to a custom sensor type. Each custom sensor driver should define one unique ID.
//
// The ID below is defined in the custom sensor driver sample available in the SDK. It identifies the custom sensor CO2 emulation sample driver.
Guid GUIDCustomSensorDeviceVendorDefinedTypeID = new Guid("4025a865-638c-43aa-a688-98580961eeae");

// A property key is defined by vendors for each datafield property a custom sensor driver exposes. Property keys are defined
// per custom sensor driver and is unique to each custom sensor type.
//
// The following example shows a property key representing the CO2 level as defined in the custom sensor CO2 emulation driver sample available in the WDK.
// In this example only one key is defined, but other drivers may define more than one key by rev'ing up the property key index.
const String CO2LevelKey = "{74879888-a3cc-45c6-9ea9-058838256433} 1";

// A pointer back to the main page.  This is needed if you want to call methods in MainPage such as NotifyUser()

MainPage rootPage = MainPage.Current;

private CustomSensor customSensor;
private uint desiredReportInterval;
private DeviceWatcher watcher;

public Scenario1_DataEvents()
{
	String customSensorSelector = "";

	this.InitializeComponent();

	customSensorSelector = CustomSensor.GetDeviceSelector(GUIDCustomSensorDeviceVendorDefinedTypeID);
	watcher = DeviceInformation.CreateWatcher(customSensorSelector);
	watcher.Added += OnCustomSensorAdded;
	watcher.Start();

	/// Invoked when the device watcher finds a matching custom sensor device
	/// </summary>
	/// <param name="watcher">device watcher</param>
	/// <param name="customSensorDevice">device information for the custom sensor that was found</param>
	private async void OnCustomSensorAdded(DeviceWatcher watcher, DeviceInformation customSensorDevice)
	{
            try
            {
                customSensor = await CustomSensor.FromIdAsync(customSensorDevice.Id);
            }
            catch(Exception e)
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    rootPage.NotifyUser("The user may have denied access to the custom sensor. Error: " + e.Message, NotifyType.ErrorMessage);
                });
            }
	}
}

More detailed API reference can be found here and UWP SDK samples can be found here

If you are interested in learning more about the new Windows 10 Sensor features, please check out the Build 2015 session on sensors. If you find bugs or issues, please leverage the Windows Feedback tool or MSDN forums.  If you would like us to add any new features, please submit them over at UserVoice or provide as comments below.


Unity Support for Windows 10

$
0
0

Today, Unity announced the release of Unity 5.2 which includes support for Windows 10 and the Universal Windows Platform (UWP).

With UWP support in Unity 5.2, developers can build a single game for Windows 10 that targets multiple devices ranging from phones to tablets to PCs to Xbox.  This means that multiple screen sizes and resolutions, different device capabilities, and a wide range of aspect ratios are all supported within a single game.

To learn more about Unity support for Windows 10, please check out the video below.  This talk, from the Build 2015 conference in April, provides information and demos showing how to write Unity games that use the Universal Windows Platform and target multiple devices.

Also, starting Unity 5.2, Visual Studio becomes the new default Unity scripting editor on Windows. The Unity installer on Windows offers to install by default the free Visual Studio Community 2015 and the Visual Studio 2015 Tools for Unity. Unity will automatically pick up VSTU where it is installed. Scripts will open directly into Visual Studio where you’ll be able to write and debug your Unity game. More on Visual Studio blog and check out these new Visual Studio tools and reading the documentation.

Use inking and speech to support natural input (10 by 10)

$
0
0

With Windows 10, it’s now easier than ever to support natural input in your apps and today we’d like to highlight using inking and speech to interact more naturally with your users.

Digital inking with DirectInk

Despite the introduction and evolution of all types of computer input devices, pen and paper remains a preferred method for humans to store information and express themselves. This is in part because of the way we’re taught to use handwriting from an early age, but it’s also been proven that writing by hand can improve thinking, remembering and learning, according to a 2013 study published in Psychological Science.

In Windows 10, we’ve made it easy for you to bring digital inking to your apps through the DirectInk platform. Collecting, rendering and managing ink through DirectInk allows you to use the same great ink experience used by Microsoft Edge, OneNote, and the Handwriting Panel. Here’s a couple of quick examples on how to implement this in your app.

Collecting ink

While in Windows 8.1 apps you had to create a Canvas, listen to input events, and render your own strokes, with Windows 10 you can now use the built-in InkCanvas control to immediately enable inking:

<Grid>
  <InkCanvas x:Name="myInkCanvas"/>
</Grid>

1_ink

This single control allows you to quickly enable inking for users, and you can also easily expand its additional functionality by accessing the InkCanvas’s InkPresenter property. InkPresenter can be used to configure a collection of ink through pen, touch, and/or mouse input, and also allows you to manipulate the drawing attributes of the ink collected on the InkCanvas. Take a look at the following example:

InkPresenter myPresenter = myInkCanvas.InkPresenter;

myPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Pen |
                               Windows.UI.Core.CoreInputDeviceTypes.Mouse;

InkDrawingAttributes myAttributes = myPresenter.CopyDefaultDrawingAttributes();

myAttributes.Color = Windows.UI.Colors.Crimson;
myAttributes.PenTip = PenTipShape.Rectangle;
myAttributes.PenTipTransform = System.Numerics.Matrix3x2.CreateRotation((float) Math.PI/4);
myAttributes.Size = new Size(2,6);

myPresenter.UpdateDefaultDrawingAttributes(myAttributes);

2_redInk

Here, you specify we want to allow collection of ink through pen and mouse, so users can ink and pen simultaneously. We also create a calligraphy brush by setting the PenTip and PenTipTransform drawing attributes of the InkPresenter.

Editing, saving, and loading ink

Now that you can offer users a canvas to ink on, you may want to empower them with more advanced control over their ink. Just as with pencil on paper, erasing is a common scenario and easy to enable through the InkPresenter’s InputProcessingConfiguration.Mode property:

private void Eraser_Click(object sender, RoutedEventArgs e)
{
  myInkCanvas.InkPresenter.InputProcessingConfiguration.Mode =
    InkInputProcessingMode.Erasing;
}

In this example, a button enables an eraser mode in the app, allowing users to go over their ink with an eraser. The great thing is that this erases individual strokes for a fast way to erase. It’s also good to know that pressing the eraser button will by default trigger Erasing mode – you don’t have to write any extra code to do so.

DirectInk uses the Ink Serialized Format (ISF) to support saving and loading of ink captures. Using the InkStrokeContainer’s SaveAsync and LoadAsync methods, you can capture the stroke data in the InkStrokeContainer and save it as a GIF file with embedded ISF data. Here’s an example:

var savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
savePicker.FileTypeChoices.Add("Gif with embedded ISF", new
System.Collections.Generic.List<string> { ".gif" }); 

StorageFile file = await savePicker.PickSaveFileAsync();
if (null != file)
{
  try
  {
    using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite))
    {
      await myInkCanvas.InkPresenter.StrokeContainer.SaveAsync(stream);
    }
  }
  catch (Exception ex)
  {
    GenerateErrorMessage();
  }
}

As you can see, we’re directly calling SaveAsync on the InkStrokeContainer and writing it to a file by using APIs you’re likely already familiar with. Similarly, LoadAsync can be used to load a set of strokes from an ISF or GIF file with embedded ISF data into your InkStrokeContainer. InkPresenter will automatically render the strokes on screen after loading them.

Going beyond plain ink

While built-in support for ink selection is not something we currently support in the DirectInk platform, InkPresenter lets you to quickly develop this functionality yourself by handling the UnprocessedInput events. These events are raised when InkPresenter receives input after its processing configuration mode is set to None, capturing the input but rendering no strokes on screen. You can also configure the same behavior for mouse right-click or the pen barrel button by using the RightDragAction property. Take a look at the following example:

// ...
myInkCanvas.InkPresenter.UnprocessedInput.PointerPressed += StartLasso;
myInkCanvas.InkPresenter.UnprocessedInput.PointerMoved += ContinueLasso;
myInkCanvas.InkPresenter.UnprocessedInput.PointerReleased += CompleteLasso;
// ...

private void StartLasso(InkUnprocessedInput sender,Windows.UI.Core.PointerEventArgs args)
{
  selectionLasso = new Polyline()
  {
    Stroke = new SolidColorBrush(Windows.UI.Colors.Black),
    StrokeThickness = 2,
    StrokeDashArray = new DoubleCollection() { 7, 3},
  };
  selectionLasso.Points.Add(args.CurrentPoint.RawPosition);
  AddSelectionLassoToVisualTree();
}

private void ContinueLasso(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args)
{
  selectionLasso.Points.Add(args.CurrentPoint.RawPosition);
} 

private void CompleteLasso(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args)
{
  selectionLasso.Points.Add(args.CurrentPoint.RawPosition); 

  bounds = myInkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(selectionLasso.Points); 

  DrawBoundingRect(bounds);
}

3_inkWithLasso

The above example manually renders a selection lasso for the selected area and then uses the InkStrokeContainer.MoveSelected() method to move the strokes within the selected area. You can also use the InkStroke.PointTransform property to transform the strokes. Rendering update of these moved or transformed strokes is automatically taken care of by InkPresenter.

This just scratches the surface of all the ways you can use the built-in configurations for input and ink rendering. Check out the Ink sample on GitHub to get a more in-depth look of the Windows.UI.Input.Inking APIs.

To wrap up the topic of ink, let’s talk about how far you can go with it. If you’ve ever played with the Fresh Paint app on Windows, you’ve probably noticed the functionality of manually determining when to “dry” the strokes on screen, allowing for fantastic control over how strokes and colors are blended together. Since InkPresenter supports Custom Drying, you can render and manage strokes on your own DirectX surface with complete control to enable powerful scenarios in your app. While this is one of the more complex features of InkPresenter, it’s worth exploring how InkPresenter helps out with rendering the “wet” strokes and blending colors. For more information and examples of Custom Drying, refer to the Complex Ink sample on GitHub.

Giving commands and having a conversation with your app

Two weeks ago in the series, we highlighted how Cortana in Windows 10 can extend your app into the core Windows 10 experience. With speech being a core input mechanism in Windows 10, you can take this interaction further by providing natural language, command and control, or dictation support in your app, allowing users to efficiently use speech in your app. Similarly, you can use text-to-speech (TTS) synthesis to have your app “talk back” to users and start a conversation.

Natural language is what we demonstrated with Cortana to support natural conversations with your app and respond to users in a natural way. Command and control is probably what most people think of when talking about speech in apps: giving specific commands to the app to quickly execute commands that would otherwise take multiple clicks or keyboard commands. Dictation fits apps where you want to capture user input word for word, for example in an e-mail or messaging app. Text-to-speech synthesis allows you to complete the other half of the conversation by generating speech from text. Let’s take a look at how you can integrate these last three methods of speech interaction in your apps.

Command and control

Recognizing speech from within your app starts with the SpeechRecognizer class. Before you start using it, however, you must ask the user’s permission to use their microphone to capture audio. This can be done by calling AudioCapturePermissions.RequestMicrophonePermission() and handling the Boolean result returned from it. Once you have the permission, you can set up the SpeechRecognizer and start recognizing user input:

// Create an instance of SpeechRecognizer.
speechRecognizer = new SpeechRecognizer(recognizerLanguage);

// Add a web search topic constraint to the recognizer.
var webSearchGrammar = new SpeechRecognitionTopicConstraint(SpeechRecognitionScenario.WebSearch, "webSearch");
speechRecognizer.Constraints.Add(webSearchGrammar);

// RecognizeWithUIAsync allows developers to customize the prompts.
speechRecognizer.UIOptions.AudiblePrompt = "Say what you want to search for...";
speechRecognizer.UIOptions.ExampleText = speechResourceMap.GetValue("WebSearchUIOptionsExampleText", speechContext).ValueAsString;

// Compile the constraint.
SpeechRecognitionCompilationResult compilationResult = await speechRecognizer.CompileConstraintsAsync();
// Start recognition.
IAsyncOperation<SpeechRecognitionResult> recognitionOperation = speechRecognizer.RecognizeWithUIAsync();
SpeechRecognitionResult speechRecognitionResult = await recognitionOperation;

The example above uses the WebSearch SpeechRecognitionScenario, which allows speech recognition in the app without having to define a specific grammar for it. Since this uses our remote web service, it will only work if speech input and dictation support is enabled in the user’s OS settings (via “Get to know me” in Settings > Privacy > Speech, inking, & typing), so you may want to add code to check for that setting and display a message if it’s not enabled:

private static uint HResultPrivacyStatementDeclined = 0x80045509;
catch (Exception exception)
{
  // Handle the speech privacy policy error.
  if ((uint)exception.HResult == HResultPrivacyStatementDeclined)
  {
    resultTextBlock.Visibility = Visibility.Visible;
    resultTextBlock.Text = "To use this feature,
      go to Settings -> Privacy -> Speech, inking and typing, and ensure you
      have viewed the privacy policy, and 'Getting to know you' is enabled.";
    // Open the privacy/speech, inking, and typing settings page.
    await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-accounts"));
  }
  else
  {
    var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
    await messageDialog.ShowAsync();
  }
}

Instead of using the WebSearch SpeechRecognitionScenario, you can provide your own grammar by using the SpeechRecognitionListConstraint class to create a simple grammar in code, or by using SpeechRecognitionGrammarFileConstraint to read from a Speech Recognition Grammar Specification (SRGS) XML file. Take a look at the documentation on MSDN on how to support these other methods of recognizing speech for command and control.

Dictation

In some scenarios, you want to offer your users a way to start dictating a potentially long piece of text, for instance to compose an e-mail or text message. The SpeechRecognizer supports continuous dictation, where you can update the UI while users are dictating. For continuous dictation, a custom grammar generally isn’t necessary, and the system will use a predefined dictation grammar by default if you don’t specify one.

Because your app may be capturing dictation over a long period of time from a background thread, we need to make sure we have a Dispatcher available to update the user interface while the user is dictating. If you’re not familiar with using a dispatcher, here’s a quick example:

private CoreDispatcher dispatcher;
dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
    dictationTextBox.Text = dictatedTextBuilder.ToString();
});

And here’s an example of how to use continuous dictation in code:

private StringBuilder dictatedTextBuilder;

// Apply the dictation topic constraint to optimize for dictated freeform speech.
var dictationConstraint = new SpeechRecognitionTopicConstraint(SpeechRecognitionScenario.Dictation, "dictation");
speechRecognizer.Constraints.Add(dictationConstraint);
SpeechRecognitionCompilationResult result = await speechRecognizer.CompileConstraintsAsync();
speechRecognizer.ContinuousRecognitionSession.Completed -= ContinuousRecognitionSession_Completed;
speechRecognizer.ContinuousRecognitionSession.ResultGenerated -= ContinuousRecognitionSession_ResultGenerated;
speechRecognizer.HypothesisGenerated -= SpeechRecognizer_HypothesisGenerated;
await speechRecognizer.ContinuousRecognitionSession.StartAsync();

First, create a StringBuilder to hold your recognized dictation. Next, initialize the SpeechRecognizer with the Dictation SpeechRecognitionScenario and start listening for the events it will raise. Finally, start the ContinuousRecognitionSession.

The ResultGenerated event is raised when dictation has been recognized, so this is where you append to our dictatedTextBuilder. It’s a good practice to check the Confidence value of the recognized text and filter out words that don’t have at least a Medium SpeechRecognitionConfidence.

The second event your app listens to is HypothesisGenerated, which is raised when the recognizer has confidence a word has been recognized correctly. Take for example the words “weight” and “wait”, which are indistinguishable from another until more context can be gleaned from surrounding words. In this case, ResultsGenerated will not get raised. The HypothesisGenerated event is thus a better place to update the user interface on recognition progress. The documentation on MSDN provides a good pattern to combine these two to keep a responsive experience for the user, even when the recognizer is still disambiguating.

Text-to-speech (TTS) synthesis

To make the speech interaction with your app less awkward, you can use text-to-speech synthesis to talk back to users. This is done through the SpeechSynthesizer, which can be used in two ways: through plain text, or through Speech Synthesis Markup Language (SSML). The difference between these is the level of control you have on how text is being synthesized. In both cases, we will need a way of playing back the synthesized speech fragment to users. The easiest way to do this is using a MediaElement control, but be aware this may interfere with audio that’s already playing on the device (for example a Groove Music stream).

To synthesize speech from text, use the following example:

private SpeechSynthesizer synthesizer;

// Create a stream from the text. This will be played using a media element.
SpeechSynthesisStream synthesisStream = await synthesizer.SynthesizeTextToStreamAsync(text);

// Set the source and start playing the synthesized audio stream.
media.AutoPlay = true;
media.SetSource(synthesisStream, synthesisStream.ContentType);
media.Play();

You can also pick a voice to be used by setting the SpeechSynthesizer’s Voice property.

Using SSML to synthesize text is very similar to the above example, with the difference of using the SynthesizeSsmlToStreamAsync method to pass SSML instead of plain text. Using this XML-type markup, you can change how speech is being synthesized:

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">

  Hello <prosody contour="(0%,+80Hz) (10%,+80%) (40%,+80Hz)">World</prosody>
  <break time="500ms" />
  Goodbye <prosody rate="slow" contour="(0%,+20Hz) (10%,+30%) (40%,+10Hz)">World</prosody>

</speak>

The above example changes the pitch and tempo of specific sections of the text. To learn more about speech recognition and speech synthesis, head over to GitHub for the Speech recognition and synthesis sample.

Wrapping up

This brings us to the end of week 5 of our Windows 10 by 10 development series. Next week, we’ll continue with multi-device support, talking about how you can tailor your app to make use of the capabilities of the device it’s running on.

For now, head on over to DVLUP for the “Inking & Speech: More Personal Computing” challenge and claim some coveted XP and points for learning all about inking and speech this week. Reach us on Twitter via @WindowsDev and #Win10x10 in the meantime, telling us how you plan to delight users with these features in your app!

Managing hidden apps, beta apps and visibility of in-app purchases in Dev Center

$
0
0

The unified Dev Center introduced several new options to manage the visibility of apps and in-app purchase. We have seen developers start to use these new capabilities and have sent us questions on how these options work in different operating systems, and how to manage betas in the new Dev Center.

In this post I’ll describe the different options available to show or hide an app, the capability of distributing apps only to testers, and the options that exist to remove an app and make it unavailable for purchase.

Defining the app distribution and visibility, and use this for beta testing

By default, your app will be available in the Store for all customers to find via searching, browsing, and a direct link.

Dev Center also offers several options to limit your app’s visibility and accessibility. During the app submission process, you will be asked to select the “Distribution and visibility” for your app. There are four options available:

1_distributionAndVisibility

Each of these options has a different impact on the app’s availability and visibility in the Store, as seen in this table:

Option Intended Use App is searchable in Store App is visible in Store (direct link) Customers that can use the app
1. “Anyone can find your app in the Store” General availability of app Yes Yes All customers (**)
2. “Hide this app in the Store. Customers with a direct link to the app’s listing can still download it, except on Windows 8.x” Limited distribution or testing of an app No Yes WP7.x, WP 8.x or Windows 10 customers with a link to the app
3. “Hide this app in the Store. Only customers with the email addresses you enter below can download it, via a direct link on Windows Phone 8.x” (*) Beta testing on WP 7.x and WP 8.x devices No Yes (only for customers on the beta list) Customers with a WP 7.x or WP 8.x, designated by you in Dev Center (via email address) and with a link to the app. Customers using Windows 8, 8.1 or 10 will not be able to download the app.
4. “Hide this app and stop selling.” Testing apps on Windows 10 devices using promo codes (for both free and paid apps); also used to “Delete” an app No Yes (listing is visible, but no new customers can download it) Customers that previously owned this app can download again, as well as new Windows 10 customers using promo codes can acquire the app

* This is exactly the same Beta capability available previously in the Windows Phone Dev Center. The same app can now be moved from Beta to public release, though can’t be moved back.
** WP 7.x, WP 8.x, Windows 8.x and Windows 10

Your chosen setting can be changed at any time, and the change will apply in 24 hours. Apps can be converted from WP beta (option 3) to any other option, but once changed, can’t be moved back to option 3.

Important: In all cases, including when hiding the app, customers may be able to see your app’s Store listing if they have access to the direct link. So if you are publishing a hidden app, or stop selling an app, and don’t want customers to find out information about your app, we recommend submitting description, screenshots and icon and, if possible, a name that won’t reveal confidential information about the app.

Read the Distribution and visibility documentation for more details.

Beta testing for Windows Phone 8.x users can be managed through option 3. Testing for Windows 10 users (Mobile or desktop) can be managed through option 4, along with the use of promotional tokens. You can read more in the beta testing and targeting distribution documentation.

In-app product (IAP) distribution and visibility

Dev Center also allows you to set a custom “Distribution and Visibility” option for in-app products. There are three options available:

2_iapOptions

Each of these options has a different effect, as seen in this table:

Option Intended Use Returned in the LoadListingInformation API? IAP Visible in Store app page** IAP can be acquired within the App
1. “Available for purchase. May be displayed in your app listing.” All IAPs available for purchase by customers. Yes Yes Yes
2. “Available for purchase. Not displayed in your app listing.” IAPs you want to make available from within the app, but not promote to new customers in your listing Yes No Yes*
3. “Not available for purchase. Not displayed in the Store app page. IAPs no longer available for purchase (except Windows 8.x) (**) No No Yes: Windows 8.x*No: Windows 10 and Windows Phone. Customers on any supported OS with a promo code can acquire the IAP.

* This feature is not supported on Windows 8.x: we recommend removing the IAP from your app code and re-publishing to remove the IAP for all customers.
** This information is visible in Windows 10 Store

Changing the visibility or distribution of your IAP will not impact customers that have already purchased it. The value set in the app submission can be changed any time, and the IAP’s visibility change will apply in 24 hours. For beta testing IAPs, we recommend including the IAP in the app, so beta testers can use it, and set the price to free during the test period.  Read the IAP distribution and visibility documentation for more info.

Deleting apps

If you want to delete an app that you’ve never submitted to the Store, click the “Delete this app” link in the upper right corner of its App overview page. Once you confirm, the app will be removed from your dashboard. Keep in mind that this also releases the reserved name, and someone else could use it.

3_deleteThisApp

You can’t delete an app from your dashboard once it’s been published. If you want to “unpublish” an app and prevent any new customers from acquiring it, create a new submission and select “Hide this app and stop selling” in the Distribution and visibility section. This will hide the app’s listing and will prevent any new customers from acquiring the app. Customers that already own your app can continue to use the app, and can re-install it.

4_hideThisApp

You can’t delete an app from your dashboard once it’s been published. If you want to “unpublish” an app and prevent any new customers from acquiring it, create a new submission and select “Hide this app and stop selling” in the Distribution and visibility section. This will hide the app’s listing and will prevent any new customers from acquiring the app. Customers that already own your app can continue to use the app, and can re-install it:

4_hideThisApp

As we continue to roll out new features and tools for Dev Center, please let us know if there are issues ( via developer support) or new features you’d like to see included in future releases (user voice).

Dynamically detecting features with API contracts (10 by 10)

$
0
0

Brent Rector, a principal program manager on Windows helped write this post.

The Universal Windows Platform (UWP) allows you to write your app once and target multiple device families, while also taking advantage of new APIs introduced on later versions of the OS as well as using unique APIs only present on certain device families. Apps that adapt their behavior for different devices or OS versions are called apps are called “adaptive apps”. There are three possible adaptive dimensions for most apps:

  1. Responsive user interface
  2. Version adaptive
  3. Platform adaptive

Last week we went through how responsive design can help tailor your app to the screen size. This week, we’ll focus on the remaining two adaptive dimensions.

Most adaptive apps will likely be version adaptive. For example, you may want your app to use some newer APIs that are only present on devices running different versions the UWP, while continuing to support customers who haven’t upgraded yet.

Some adaptive apps will want to be platform adaptive. Again, your app may be built for all device families, but you may want to use some mobile-specific APIs when it’s running on a mobile device. And similarly for other device families, such as IoT, HoloLens, Xbox, etc.

While this article will describe the ways in which your app can become version or platform adaptive, with Windows 10, 85% of UWP APIs are fully accessible to any app, independent of where it runs. This Universal Windows API set makes up 96.2% of the APIs used by the top 1000 apps. You can take advantage of the specialized APIs on each device to further tailor your app.

1_10x10_apiContracts

Detect features, not OS or devices

The fundamental idea behind adaptive apps is that your app checks for the functionality (or feature) it needs, and only uses it when available. The traditional way of doing this is by checking the OS version and then use those API. With Windows 10, your app can check at runtime, whether a class, method, property, event or API contract is supported by the current operating system. If so, the app can then call the appropriate API. The ApiInformation class located in the Windows.Foundation.Metadata namespace contains several static methods (like IsApiContractPresent, IsEventPresent, and IsMethodPresent) which are used to query for APIs. Here’s an example:

using Windows.Foundation.Metadata;
    
if(ApiInformation.IsTypePresent("Windows.Media.Playlists.Playlist"))
{
    await myAwesomePlaylist.SaveAsAsync( ... );
}

This code

  • makes a runtime check for the presence of the Playlist class, then
  • statically references and calls the SaveAsAsync method on the class.

Note the ease of checking for the presence of a type on the current operating system using the IsTypePresent API. Formerly, such a check might have required LoadLibrary, GetProcAddress, QueryInterface, Reflection, use of the ‘dynamic’ keyword, and others, depending on language and framework.

Also note the static reference when making the method call. When using Reflection and/or ‘dynamic’, you lose static compile-time diagnostics that would, for example, inform you if you misspelled the method name.

Detecting with API contracts

So what’s an API contract? At heart, an API contract is a set of APIs. A hypothetical API contract could represent a set of APIs containing two classes, five interfaces, one structure, two enums and so on. We group logically related types into an API contract. In many ways, an API contract represents a feature – a set of related APIs that together deliver some particular functionality. Every Windows Runtime API from Windows 10 onward is a member of some API contract. The documentation at https://msdn.microsoft.com/en-us/library/windows/apps/dn706135.aspx describes the variety of API contracts available. You’ll see that most of them represent a set of functionally related APIs.

But the grouping into an API contract also provides you, the developer, some additional guarantees. The most important one is that when a platform implements *any* API in an API contract, we require that platform to implement *every* API in that API contract. In other words, an API contract is an atomic unit, and testing for support of that API contract is equivalent to testing that each and every API in the set is supported.

What does this mean for your app?

It allows your app to test whether the running OS supports a particular API contract and, after determining it does, call any of the APIs in that API contract without checking each one individually.

The largest and most commonly used API contract is the Windows.Foundation.UniversalApiContract. It contains nearly all of the APIs in the Universal Windows Platform. If you wanted to see if the current OS supports the UniversalApiContract, you would write the following code:

if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract"), 1, 0)
{
    // All APIs in the UniversalApiContract version 1.0 are available for use
}

Right now this is a slightly silly check. All devices that run Windows 10 support version 1.0 of the UniversalApiContract. But with the next major update of Windows 10, we may introduce additional APIs, creating a version 2.0 of the UniversalApiContract and adding those new universal APIs to it. An app that wants to run on all devices, but also wants to use new APIs introduced in version 2.0 when available, could use the following code:

if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract"), 2, 0)
{
    // This device supports all APIs in UniversalApiContract version 2.0
}

Of course, if your app only needed to call one single method from version 2.0, it could simply check for the method using IsMethodPresent. Use whichever approach you find the easiest.

There are other API contracts besides the UniversalApiContract. Most of them represent a feature/set of APIs not universally present on all Windows 10 platforms (else we’d add the APIs to the UniversalAPIContract). Instead, the APIs in such API contracts are present on one or more device families, but not all of them. As mentioned previously, you no longer need to check for a particular type of device, then infer the support for an API from the device family. Simply check for the set of APIs your app wants to use.

I can now rewrite my original example to check for the presence of the Windows.Media.Playlists.PlaylistsContract instead of just checking for the present of the Playlist class:

if(ApiInformation.IsApiContractPresent("Windows.Media.Playlists.PlaylistsContract"), 1, 0)
{
    // Now I can use all PlayList APIs
}

Any time your app needs to call an API that isn’t present across all device families, you need to add a reference to the appropriate Extension SDK that defines the API. In Visual Studio 2015, go to the Add Reference dialog and open Extensions tabs. Today you can find the three most important extensions there: Mobile Extension, Desktop Extension and IoT Extension.

All your app needs to do, however, is check for the presence of the desired API contract and call the appropriate APIs conditionally. There’s no need to worry about the type of device.

Now the question is: I need to call the PlayList API but it’s not a universally available API. The documentation (https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.playlists.playlist.aspx) tells me what API contract the class is in. But what Extension SDK(s) define(s) it?

As it turns out, the Playlist class is (currently) only available on Desktop devices, not Mobile, Xbox, and other device families. (Though that could change in a future release!) So you need to add a reference to the Desktop Extension SDK before any of the prior code compiles.

Lucian Wischik created a tool that analyzes your code and when your code calls into a platform-specific API, the analyzer verifies that you’ve done an adaptivity check around it — if you haven’t then it reports a warning. It also provides a handy “quick-fix” to insert the correct check, by pressing Ctrl+Dot or clicking on the lightbulb. See https://github.com/ljw1004/blog/blob/master/Analyzers/PlatformSpecificAnalyzer/ReadMe.md for more details. It can also be installed via NuGet if you search for it.

Let’s wrap up by looking at some more complete examples of adaptive coding for Windows 10. First, some code that IS NOT correctly adaptive.

// this code will crash if called from IoT or Mobile
async private Task CreatePlaylist()
{
    StorageFolder storageFolder = KnownFolders.MusicLibrary;
    StorageFile pureRockFile = await storageFolder.CreateFileAsync("myJam.mp3");
    Windows.Media.Playlists.Playlist myAwesomePlaylist = new Windows.Media.Playlists.Playlist();

    myAwesomePlaylist.Files.Add(pureRockFile);
    
    // code will crash here as this is a Desktop only call. 
    await myAwesomePlaylist.SaveAsAsync(KnownFolders.MusicLibrary, "My Awesome Playlist", NameCollisionOption.ReplaceExisting);
}

The example below verifies that this a safe call before executing code with the API. This will prevent runtime crashes. (The PlatformSpecific analyzer will catch issues like this in your code.)

async private Task CreatePlaylist()
{
    StorageFolder storageFolder = KnownFolders.MusicLibrary;
    StorageFile pureRockFile = await storageFolder.CreateFileAsync("myJam.mp3");
    Windows.Media.Playlists.Playlist myAwesomePlaylist = new Windows.Media.Playlists.Playlist();

    myAwesomePlaylist.Files.Add(pureRockFile);
    
    // now I'm a safe call!  Cache this value if this will be queried a lot
    if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Media.Playlists.Playlist"))
    {
        await myAwesomePlaylist.SaveAsAsync(KnownFolders.MusicLibrary, "My Awesome Playlist", NameCollisionOption.ReplaceExisting);
    }
}

We are now verifying that the optional API is actually supported on this device before calling the appropriate method. Note that you’ll likely want to take this example further and never even display the UI that calls the CreatePlaylist method if your app detects that playlist functionality isn’t available on the device.

Here is another example. We’ll assume our app wants to take advantage of a Mobile device’s dedicated camera button. If I directly referenced the HardwareButtons object for the CameraPressed event while on a desktop without checking that HardwareButtons is present, my app would crash.

// Note: Cache the value instead of querying it more than once.
bool isHardwareButtonsAPIPresent = 
        Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons");

if (isHardwareButtonsAPIPresent)
{
    Windows.Phone.UI.Input.HardwareButtons.CameraPressed +=
        HardwareButtons_CameraPressed;
} 

Want to learn more? Brent Rector has a great talk on API Contracts from Build 2015. And MVA has a topic on “A Developer’s Guide to Windows 10” on adaptive code that covers this topic in more detail.

Wrapping up

With week 6 of our Windows 10 by 10 development series wrapped up, we hope you try the DVLUP Quiz challenge Adaptive APIs and earn XP and points for the API contracts. Next week, we’ll continue with app to app communication talking about how you can have your app talk to another app.

For now, head on over to DVLUP for Reach us on Twitter via @WindowsDev and #Win10x10 in the meantime, telling us how you plan to use API contracts!

Quick references:

Learn about the samples for Universal Windows Platform

$
0
0

One way to learn app development for the Universal Windows Platform (UWP) is by taking advantage of the extensive and growing samples collection on GitHub. You can use these samples to learn about specific UWP features and APIs and as a source of working code that you can copy and paste into your projects.

These samples include API and feature demos as well as some small but complete apps that show you how to combine multiple features in a more realistic setting.

Many of the samples are available in C#, JavaScript, and C++, so you can find the most familiar code . Because they are UWP apps targeting the universal device family, they will also run on the entire range of supported devices, including desktop computers, tablets, phones, Xbox consoles, Surface Hubs, and HoloLens devices.

API and feature samples

The API and feature samples collection covers numerous scenarios ranging across the entire platform. For convenient browsing, the 190-plus samples are divided into these categories:

  • App settings
  • Audio, video, and camera
  • Communications
  • Contacts and calendar
  • Controls, layout, and text
  • Custom user interactions
  • Data
  • Deep links and app-to-app communication
  • Devices and sensors
  • Files, folders, and libraries
  • Gaming
  • Globalization and localization
  • Graphics and animation
  • Identity, security, and encryption
  • Launching and background tasks
  • Maps and location
  • Navigation
  • Networking and web services
  • Platform architecture
  • Speech and Cortana
  • Threading
  • Tiles, toasts, and notifications

If you are new to development or new to the Windows platform, these samples are a great place to start. Just by running and exploring them, you can get a great idea of the available features. You can learn even more by experimenting with the code while reading the UWP documentation on the dev center. Each sample has a README.md file that describes the scenarios it covers and provides links to the related feature docs. The following sections show some examples of what you’ll find in our Windows-universal-samples collection.

XAML

The XAML UI basics sample shows the different XAML controls and layout panels available.

1_sampleUiBasic

Other XAML-specific samples provide more detail on specific controls or scenarios, such as ListView and GridView, Pivot, and navigation patterns.

Direct2D

The Direct2D photo adjustment sample shows how to use Direct2D to manipulate images.

2_direct2d

Other Direct2D samples cover custom image effects and gradient meshes. Of course, there are Direct3D samples in this collection as well, plus a separate DirectX-Graphics-Samples collection.

Map

The MapControl sample shows how we’ve combined the different mapping features available in earlier platforms into a new, unified experience that works across all supported devices.

3_maps

These are just a few examples of the many API and feature samples available, ranging from networking samples to audio/video/camera and Cortana samples. See the Windows-universal-samples collection for more info. If you don’t see a sample you’re looking for, or you have any feedback on the existing samples, let us know via the Issues list. We’re updating the samples collection on a weekly basis, so check back regularly for the latest changes.

Bringing the features together into real apps

When you start to build your apps, you might wonder how these platform features can work together to form more compelling scenarios. This is where our full app samples come into play.

These samples are fully functional, but small enough to learn from without too much distracting complexity. The goal here is to combine 3 or 4 platform features in each app – just enough to demonstrate how to solve some problems that arise in the real world, such as data management and code organization.

Each of these samples is intentionally missing the kind of polish you will need in a successful app, such as compelling tiles, splash screens, and sharing capabilities. This simplification makes them suitable both for easier learning and for forming the basis of your apps. You can copy any or all of the code from these apps into your own projects, which you can then extend, turning them into your own unique apps that you can publish to the Windows Store and monetize.

App samples

Currently, there are only a few real-world app samples, but more are in the works.

TrafficApp shows how to build a traffic monitoring app by combining the MapControl, location and route services, background tasks, and toast notifications. Although this app uses a conventional code-behind structure, it demonstrates some organizational best practices with a reusable LocationHelper component that can help you build similar apps.

4_traffic

RSS Reader shows how to build a news app using the syndication APIs, serialization and local storage, and an adaptive layout. This app also demonstrates best practices by using a basic Model-View-ViewModel (MVVM) architecture.

5_rssFeeder

QuizGame shows how to use networking features to build a pub-style trivia game where questions aredisplayed on a big screen while players answer the questions on their own devices. This demonstrates how the same app instance can effectively run simultaneously on multiple devices in direct communication with one-another.

6_quizApp

The screenshot below shows the app in test mode where you can see the host UI on the left and two copies of the client UI on the right, before and after a question is answered. Although the UI is simple, this sample provides a well-architected basis for building similar apps, and uses a more elaborate MVVM architecture and a reusable peer-to-peer helper component.

Like the API and feature samples collection, each of these app samples has its own Issues list on GitHub that you can use to provide feedback or request changes. If there are any scenarios you’d like to see in the form of a small-but-complete sample app, just add a comment to this blog post or to any of the Issues lists on the GitHub pages for the samples.

Initial preview of Silverlight bridge to UWP

$
0
0

Today marks the initial release of Mobilize.NET’s Silverlight bridge, which helps Windows Phone Silverlight app developers bring their WP Silverlight 8.x apps to the Windows 10 Universal Windows Platform (UWP). Announced at Build 2015, the Moblize.NET bridge is free and directly integrates into Visual Studio. The bridge currently maps the 700 most used APIs and handles transitioning your manifests, APIs, XAML, NuGet package references and async/await changes. More APIs and mappings will follow with future updates. Mobilize.NET has a much more in-depth post on the Silverlight bridge that goes into detail on the features, so here we share only a high-level overview of the tool.

Once you use the tool to bring your app to the UWP, your app will have all the power of a UWP app, including the ability to – from a single code base – run on a PC, phone, Xbox, HoloLens, or even a Raspberry Pi.

Running the bridge

Once installed, open up Visual Studio, load your WP Silverlight app, then right-click your project from the Solution Explorer and select the “Convert to UWP” option. Additionally, any project that is in the solution will be migrated.

1_migrateSlToUwp

Helping extend and improve the mappings

The Silverlight bridge does the migration with a feature named the Mapping Mechanism. All mappings bundled with the tool have been open sourced and published in a public GitHub repository (https://github.com/MobilizeNet/UWPConversionMappings). This way developers around the world can use them as a reference implementation to write their own.

Start Migrating

The Silverlight bridge may not do a full transition as this is an initial preview now but the tool should get you most of the way. Since Silverlight is similar to UWP but not the same so most errors should be pretty straightforward to resolve. Once you fix compiler errors, you should be ready to start testing and adjusting your app.

The Building apps for Windows 10×10 article series has some helpful guidance on building apps. Topics range from building responsive UIs, speech, live tiles, to how to help get your app promoted in the Store.

Update on Node.js for Windows 10 IoT

$
0
0

Post written by Arunesh Chandra, Sr. Program Manager and Gaurav Seth, Principal Program Manager Lead on Chakra

Ever since we announced our preview of Node.js support for Windows 10 IoT Core a few months back, we have been working to enable new scenarios and improve its ease of use.  Here is what is new:

  1. Making it easier to get started

    Between studying the pin diagram to understand how to wire sensors on the board to getting the right bits on the device, the workflow of an IoT developer is already non-trivial, and the current experience of getting started with Windows 10 IoT using Node.js Chakra was a “high friction” process. Developers had to discover and install NTVS, NTVS IoT extension, and in some cases manually build Node.exe to work with Chakra etc.

    In order to improve this acquisition experience, we announce the availability of a bundle installer for Node.js tools for Windows IoT. This installs all the correct versions of the essential tools and also installs Node.exe, which works with Chakra. This installation works side by side in an existing default Node.js installation without disrupting it. The installer also creates the correct folder layout necessary to make node-gyp dependent node modules work without using any workarounds.

    1_nodeJsInstaller

    Please check out these steps which have links to detailed instructions on how to get started with your own Raspberry Pi 2 or other supported IoT device.

  2. Support for cylon, serialport and firmata

    We are committed to improving the compatibility of Node.js support on Windows IoT with npm modules. We started with popular modules for IoT scenarios. While this is a work in progress, we are happy to share that serialport, cylon and firmata are now fully supported.

    With this release we have also added a cylon project template and have a sample using serialport, cylon and firmata to help you get started with them. We have submitted a pull request (PR) on serialport to have it work by default on Node.js with Chakra.

    2_newNodeJsCylon

    Please let us know any other modules you are having trouble with when using Node.js with Chakra – it will help us prioritize our work better.

  3. Support for Node v4.0.0 and looking ahead

    Node v4.0.0 (stable) is out. We have been trying to keep up with the pace of change on this new converged repo to make Chakra work with Node v4 and submit a PR to the mainline.

    As the next step before we submit a PR on Nodejs/node (master), we have now published the code delta to enable Chakra on Node v4.0.0 on our repo to start getting early feedback on the same from key Node contributors and the Node community.

    Porting these changes to v4.0.0 required us to make some changes and additions to Chakra’s hosting APIs for external ArrayBuffer support. This support was added and previewed in the latest Windows Insider build. The latest Insider build also brings more advanced ES6 support with ES6 Classes, ES6 Generators, ES6 Destructuring, ES7 Async Functions and ES7 Exponentiation operator, among other ES6 features already supported by Chakra (see ES6 compat table).

    To run and test the abovementioned changes for Node v.4.0.0, join the Windows Insider Program and install the latest publicly-available Windows 10 flight.

    We understand that the above might not be ideal for all and thus we plan to submit a PR to the Node mainline as soon as these API updates become broadly available on Windows 10. We’ll of course inform the community once we know the exact timing.

Thanks for all the support so far! Your feedback is critical to this project and as always, we love to hear from you. So please keep it coming.


More ways to bring your code to fast-growing Windows 10 Store

$
0
0

Windows 10 adoption surpassed 75 million devices in 192 countries within its first month of availability and we’re already seeing a shift in the way people engage with Windows Store and the content they find there. Shifts in customer behavior tend to bring new opportunities for developers, so today I’ll share insight into early trends and highlight a few new and updated tools that are making it easier for more developers to deliver apps for Windows 10 in time for the holiday rush.

Store experience drives increased customer engagement

More people are upgrading to Windows 10 and visiting Windows Store every day. And they aren’t just window-shopping. The average Windows 10 customer is downloading six times more apps than the average customer on Windows 8.

This shift in behavior is due in part to the fact that we have taken steps to change the way people discover and experience apps in Windows 10. Features both inside and outside of the Store that are fast becoming part of people’s daily lives. As customers use Windows 10 it gets better at suggesting information and content that help people DO more in ways that are personal and relevant. For example, Cortana provides app recommendations based on the customer’s personal interests. In addition, the Start menu, Microsoft Edge and the Notification Center will also suggest apps that customers might enjoy.

In the Store itself, we’ve created a more visual experience, added new search and list algorithms built specifically for the Store (vs. standard web search), and expanded the catalog of digital content that people can shop for when they browse the Store (such as music, movies, and TV shows).

New & updated tools for bringing apps to the Store

As Windows Store traffic, downloads and developer revenue continue to grow, we want to make it as easy as possible to develop or update apps for Windows 10. In addition to the Windows 10 SDK and middleware solutions, we’ve invested in bridge technologies that make it easy to bring your code to the Windows platform and reach this growing base of Windows 10 users with existing mobile, Windows and web apps.

In August we open-sourced an early preview of the Windows Bridge for iOS. We’ve received great feedback from the community (including a number of pull requests), which is influencing our development efforts. So far we’ve added libdispatch, initial support for Storyboards, and a vastly improved NSCalender among other new features and fixes. On top of the API and tooling work, we’re starting to build better tests, docs, and visualizations so you’ll be able to quickly and easily see what works, what doesn’t, and what’s currently in progress.

In June we launched the bridge for hosted web apps, enabling you to create new, or convert existing, web apps for distribution via Windows Store. Within the app you can light up native Windows 10 features such as Live Tiles, Cortana integration or push notifications to deliver a richer user experience. To make it even easier to create a hosted web app for Windows 10, today we’re launching integration into Windows App Studio Beta – where you can create one with just a few clicks.

Finally, many of our partners are releasing Windows 10 tools, offering you additional solutions. I’m especially pleased to announce releases from two partners: Mobilize.Net and Unity.

Mobilize.Net recently released a developer preview for their bridge for Windows Phone Silverlight developers. The bridge helps accelerate bringing apps to the Universal Windows Platform (UWP) to engage users across PCs, tablets, phones and more. In this preview release, the bridge provides over 700 platform mappings and translations from Silverlight to UWP, with a further expansion to 1,600 mappings planned for later this year. The bridge will also offer a rich, open source, extensibility model enabling you to add to the mappings and transformations on GitHub. More information can be found in their blog post on the bridge and expect more mappings to be added on a regular basis.

Unity recently announced support for Windows 10 with the release of Unity 5.2, enabling developers to build games that target multiple devices ranging from phones to PCs to Xbox. Paradox and Cocos2d-X now also support building Universal Windows games and we continue working with other middleware providers to help you bring your code to Windows.

If you haven’t already, I’d like to encourage you to download the Windows 10 SDK. If you use in-app advertising, also download the Microsoft Advertising Client SDK, which includes support for video interstitials and ad mediation to improve both fill rates and monetization by taking advantage of multiple ad networks within a single code base. Your Microsoft Advertising ad units are now set up, managed and tracked right in Dev Center for added convenience.

More to Come. . .

Windows 10 adoption is off to a solid start, but there is more to come. Now that the Windows Store is itself a Universal Windows Platform app, we will be updating the Store more frequently to bring new capabilities (and bug fixes) to market faster. For example, we’ve already released Store updates to add device filtering for ratings & reviews (available on the app’s listing page) and to address initial constraints with search. And you can expect us to add new capabilities in the coming months, including support for carrier billing (paying for apps via your phone bill) on PCs and tablets to help you reach customers who don’t have a credit card or traditional payment methods, as well as enabling you to offer in-app subscriptions. We’ll also launch the first phase of a new storefront designed to help organizations to acquire, distribute and manage digital content across their small business, enterprise or education institutions. And, of course we will release Windows 10 for mobile devices.

What are you waiting for? I’d like to encourage you to start developing for Windows 10 today.

Using cross-app communication to make apps work together (10 by 10)

$
0
0

With Windows 10, the Universal Windows Platform (UWP) provides a number of improvements to better support sharing data and files across Windows apps.

Cross-app communication in Windows 10

Windows 10 introduces some new and improved ways to ease communication between apps on the same device, whether it’s an app launching another app with some data, or apps simply exchanging data without launching anything.

There are no restrictions or limits on which apps can talk to each other, or what kind of data they can exchange. This means that apps can define their own contracts with each other and extend each other’s functionality. It also makes it possible for app developers to break their apps into smaller experience chunks that are easier to maintain, update, and consume.

Reintroducing drag and drop

If you’ve developed for desktop before, you’re probably already familiar with the basics of drag and drop. In Windows 10, drag and drop has been reintroduced as UWP app APIs – with new features that enhance the UX. By fully exploiting these features, you can give the user a more tailored experience.

In this article, we’ll walk through how to deep-link apps, set up logic sharing between apps, and implement drag-and-drop concepts.

Deep linking: Getting an app ready

To demonstrate how to deep-link, we’ll use an example of a product inventory app that displays product details, along with a sales app that shows broad sales trends. To display individual product details, the sales app will deep-link into the inventory app.

The first step is making the inventory app available to be launched by other apps. To do this, we add a protocol declaration to the inventory app’s package manifest (Package.appxmanifest). Here’s how this declaration looks in the graphical editor, and the XML snippet it generates.

1_appManifest

<uap:Extension Category="windows.protocol">
    <uap:Protocol Name="com.contoso.showproduct" />
</uap:Extension>

Next, we need to add activation code so the app can respond appropriately when launched. The code goes into the inventory app’s Application class (App.xaml.cs), where all activations are routed. To respond to protocol activations, we need to override the OnActivated method of the activation class. That code looks like this:

protected override void OnActivated(IActivatedEventArgs args)
{
    Frame rootFrame = CreateRootFrame();

    if (args.Kind == ActivationKind.Protocol)
    {
        var protocolArgs = args as ProtocolActivatedEventArgs;
        rootFrame.Navigate(typeof(ProtocolActivationPage), protocolArgs.Uri);
    }
    else
    {
        rootFrame.Navigate(typeof(MainPage));
    }

    // Ensure the current window is active
    Window.Current.Activate();
}

In this code, we check the incoming IActivatedEventArgs to determine if it is a protocol activation. If so, we typecast the incoming arguments as ProtocolActivatedEventArgs and send the incoming URI to the ProductDetails page. The ProductDetails page is set up to parse a URI such as com.contoso.showproduct:Details?ProductId=3748937 and show the corresponding product’s details. The inventory app can now handle incoming deep links.

Deep linking into the app

Finally, we can enable the sales app to deep-link into the inventory app. The app simply uses the Launcher.LaunchUriAsync method to deep-link into the inventory app. The code might look like this:

Uri uri = new Uri("com.contoso.showproduct:?ProductId=3748937");
await Launcher.LaunchUriAsync(uri);

Launching a specific app

With Windows 10, you now also have the ability to launch a specific app for when you want to control which app the user is launched into. Look at the code below:

var options = new LauncherOptions();
options.TargetApplicationPackageFamilyName = "24919.Contoso.InventoryApp";

Uri uri = new Uri("com.contoso.showproduct:?ProductId=3748937");
await Launcher.LaunchUriAsync(uri, options);

We can invoke a specific app through the LauncherOptions of the Launcher. Using this API, you can specify the TargetApplicationPackageFamilyName, the unique name you get when you register an app. By specifying this name alongside the launch URI, you can easily launch a specific app that implements the protocol declaration.

Sharing a file between apps

You can also make files accessible to the app you’re launching, using another new API, SharedStorageAccessManager.AddFile, which returns a token that you can send to the launched app. A data structure called ValueSet is used for communication between the apps. ValueSets are key/value dictionaries that can carry simple types: integers, floating-point numbers, strings, and byte arrays. In the following example, we use this API to make an IStorageFile instance available to the inventory app.

var options = new LauncherOptions();
options.TargetApplicationPackageFamilyName = "24919.Contoso.InventoryApp";

var token = SharedStorageAccessManager.AddFile(gpxFile);

ValueSet inputData = new ValueSet();
inputData.Add("Token", token);

Uri uri = new Uri("com.contoso.showproduct:?ProductId=3748937");
await Launcher.LaunchUriAsync(uri, options, inputData);

Launching an app to get a result back

In previous versions of Windows, if you wanted to launch an app and make it do something, there was no programmatic way of notifying you that the action was completed. With the new “launch for results” feature, that has changed. Let’s take a look at the code:

var options = new LauncherOptions();
options.TargetApplicationPackageFamilyName = "24919.Contoso.InventoryApp";
var launchUri = new Uri("com.contoso.showproduct:?ProductId=3748937");
await Launcher.LaunchUriForResultsAsync(launchUri, options, data);

var resultData = new ValueSet();
resultData.Add("Result", value);
operation.ProtocolForResultsOperation.ReportCompleted(resultData);

The new LaunchUriForResultsAsync method relies on the TargetApplicationPackageFamilyName API to make two-way communication between apps possible. That’s all we need in the sales app and we can now implement the following in the inventory app:

var resultData = new ValueSet();
resultData.Add("Result", value);
operation.ProtocolForResultsOperation.ReportCompleted(resultData);

This uses another ValueSet, but this time the data is passed back from the inventory app to the sales app when the ReportCompleted method is called.

Data sharing between apps

In other scenarios, apps may need to share data without sending the user into another app. For example, the sales app can display sales by region or store, and when that data is categorized by product, you might want to show how many products are available in a store or region. Although the inventory app would be the best source for that data, launching the inventory app in this case would disrupt the user experience. That’s the exact scenario app services are designed to handle.

In the examples below, we’ll show how the inventory app can provide a service, invoked by the sales app, to query the inventory app for its data.

Creating the inventory app service

To add an app service, we add a Windows Runtime Component to the solution that contains the inventory app.

2_newProject

Inside the project, we then add a new class called InventoryServiceTask that implements the IBackgroundTask interface. We must then get a BackgroundTaskDeferral to tell the operating system that the task is used as an app service and should be kept around for as long as the client needs it. We must also attach an event handler to the app service-specific RequestReceived event. The handler is invoked whenever the client sends a request for this service to handle. The code to initialize the inventory app service:

namespace Contoso.Inventory.Service
{
    public sealed class InventoryServiceTask : IBackgroundTask
    {
        BackgroundTaskDeferral serviceDeferral;
        AppServiceConnection connection;

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            //Take a service deferral so the service isn't terminated
            serviceDeferral = taskInstance.GetDeferral();

            taskInstance.Canceled += OnTaskCanceled;

            var details = taskInstance.TriggerDetails as AppServiceTriggerDetails;
            connection = details.AppServiceConnection;

            //Listen for incoming app service requests
            connection.RequestReceived += OnRequestReceived;
        }
    }
}

Now, let’s look at the implementation of the RequestReceived handler. Once again, we take a deferral as soon as a request comes in, but this time it’s an AppServiceDeferral, which we’ll release when we’re done handling the incoming request. Again, we use a ValueSet to pass data to the app service. We also handle the Canceled event to gracefully handle cancellation or the app service’s task.

async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
{
    //Get a deferral so we can use an awaitable API to respond to the message
    var messageDeferral = args.GetDeferral();

    try
    {
        var input = args.Request.Message;
        string command = input["Command"] as string;

        switch(command)
        {
            case "GetProductUnitCountForRegion":
                {
                    var productId = (int)input["ProductId"];
                    var regionId = (int)input["RegionId"];
                    var inventoryData = GetInventoryData(productId, regionId);
                    var result = new ValueSet();
                    result.Add("UnitCount", inventoryData.UnitCount);
                    result.Add("LastUpdated", inventoryData.LastUpdated.ToString());

                    await args.Request.SendResponseAsync(result);
                }
                break;

            //Other commands

            default:
                return;
        }
    }
    finally
    {
        //Complete the message deferral so the operating system knows we're done responding
        messageDeferral.Complete();
    }
}
private void OnTaskCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
{
    if (serviceDeferral != null)
    {
        //Complete the service deferral
        serviceDeferral.Complete();
        serviceDeferral = null;
    }
}

Next, the inventory app service needs to be published and given an endpoint. That process starts by updating the inventory app project so it has a reference to the Windows Runtime Component we just created. The Entry point is set to the fully qualified name of the InventoryServiceTask class; Name is the name we’ll use to identify the endpoint. This is the same name the app service’s clients will use to reach it.

To communicate with the inventory app service, clients also need the package family name of the inventory app. The easiest way to get this value is to use the Windows.ApplicationModel.Package.Current.Id.FamilyName API within the inventory app. You can do this by outputting this value to the debug window and picking it up from there.

3_appManifest

<uap:Extension Category="windows.appService" EntryPoint="Contoso.Inventory.Service.InventoryServiceTask">
    <uap:AppService Name="com.contoso.inventoryservice"/>
</uap:Extension>

Calling the inventory app service

Finally, the inventory app service can be called from the sales app. In order to do that, a client can use the AppServiceConnection class. An instance of this class requires the name of the app service endpoint and the package family name of the package where the service resides.

Below, you see the code the sales app uses to connect to the app service. We need to plug the Package Family Name of the inventory app into the AppServiceConnection.PackageFamilyName property. Once we’re ready, we call the AppServiceConnection.OpenAsync method to open a connection. This returns a status upon completion, which indicates if the connection was successful or not.

When connected, the client sends the app service a set of values in a ValueSet using the AppServiceConnection.SendMessageAsync method. The Command property in the ValueSet is set to GetProductUnitCountForRegion, which we know the app service understands. SendMessageAsync returns a response containing the ValueSet sent back by the app service. Then, we parse out and display the UnitCount and LastUpdated values.

When the AppServiceConnection is disposed the corresponding app service background task is torn down. This is good practice to prevent the app service taking up memory and CPU that the app could use.

using (var connection = new AppServiceConnection())
{
    //Set up a new app service connection
    connection.AppServiceName = "com.contoso.inventoryservice";
    connection.PackageFamilyName = "Contoso.Inventory_876gvmnfevegr";

    AppServiceConnectionStatus status = await connection.OpenAsync();

    //The new connection opened successfully
    if (status != AppServiceConnectionStatus.Success)
    {
        return;
    }

    //Set up the inputs and send a message to the service
    var inputs = new ValueSet();
    inputs.Add("Command", "GetProductUnitCountForRegion");
    inputs.Add("ProductId",productId);
    inputs.Add("RegionId", regionId);

    AppServiceResponse response = await connection.SendMessageAsync(inputs);

    //If the service responded with success display the result and walk away
    if (response.Status == AppServiceResponseStatus.Success)
    {
        var unitCount = response.Message["UnitCount"] as string;
        var lastUpdated = response.Message["LastUpdated"] as string;

        //Display values from service
    }
}

Using drag and drop in Windows 10

Now let’s turn our attention to drag-and-drop functionality in Windows 10. Using drag and drop, you can transfer data between applications or within an application using a standard gesture, such as press-hold-and-pan with the finger or press-and-pan with a mouse or a stylus.

The drag source – the area where the drag gesture is triggered – provides the data to be transferred by filling a data package object that can contain standard data formats, including text, RTF, HTML, bitmaps, storage items, or custom data formats. The source also indicates the kind of operations it supports: copy, move, or link. When the pointer is released, the drop occurs. The drop target, which is the application or area underneath the pointer, processes the data package and returns the specific type of operation it performed.

The drag UI provides a visual indication of the type of drag-and-drop operation that’s taking place. This visual indicator is initially provided by the drag source, but can be changed by the drag target as the pointer moves there. Drag and drop allows data transfer between or within any kind of application, including Classic Windows applications, although this article focuses on the XAML API for drag and drop in UWP apps.

Making the UIElement draggable

You can any UIElement draggable by setting its CanDrag property to true in the XAML markup or the code-behind. The XAML framework handles gesture recognition and fires the DragStarting event, indicating the start of a drag operation. The application must configure the DataPackage, provided in the Data property of the DragStartingEventArgs, by filling its content and specifying the supported operations.

<Grid CanDrag="True" DragStarting="SourceGrid_DragStarting">
    ...
</Grid>
private void SourceGrid_DragStarting(UIElement sender, DragStartingEventArgs args)
{
    if (_fileSource == null)
    {
        args.Cancel = true;
    }
    else
    {
        args.Data.RequestedOperation = DataPackageOperation.Copy | DataPackageOperation.Move;
        args.Data.SetStorageItems(new IStorageItem[] { _fileSource });
    }
}

If you’d like to cancel the drag operation in the event handler, simply set the Cancel property of the DragStartingEventArgs parameter.

Once the user has released the pointer, the drag-and-drop operation is complete, and the source is notified through the DropCompleted event, which contains the DataPackageOperation returned by the target on which the user released the pointer (or DataPackageOperation.None if the pointer was released on a target that doesn’t accept the data, or if Cancel was pressed).

private void DropGrid_DropCompleted(UIElement sender, DropCompletedEventArgs args)
{
    if (args.DropResult == DataPackageOperation.Move)
    {
        // Move means that we should clear our own image
        Picture = null;
        _bitmapSource = null;
        _fileSource = null;
    }
}

Implementing a drop target

Any UIElement can be a drop target, as long as its AllowDrop property is set to true. During drag and drop, DragEnter, DragOver, DragLeave, and Drop events can be raised. Although these events already exist in Windows 8.1, the DragEventArgs class has been extended in Windows 10 to give applications access to all the features of modern drag and drop.

When handling a drag-and-drop event, the target application should first inspect the content of the DataPackage through the DataView property of the event argument. In most cases, checking for the presence of a data type is enough and can be done synchronously. In some cases, such as with files, the application might have to check the type of the available files before accepting or ignoring the DataPackage.

Once the target has determined if it can process the data, it must set the AcceptedOperation property of the DragEventArgs instance to allow the system to provide the right feedback to the user.

If the application returns DataTransferOperation.None—or an operation not accepted by the source—from an event handler, the drop will not take place even if the user releases the pointer over the target. Instead, the DragLeave event will be raised.

The application can handle either DragEnter or DragOver; the AcceptedOperation returned by DragEnter is kept if DragOver isn’t handled. As DragEnter is called only once, that’s the event you should use over DragOver for performance reasons. For nested targets, though, you’ll need to return the correct value from DragOver in case a parent target might override it.

A scenario to illustrate drag and drop could be a Photo Booth application with UI components that are both drag sources and drop targets. In the application, each photo placeholder checks for images in the DataPackage and routes the event only to the parent grid if there isn’t an image available. This allows the grid to accept text even if it is physically dropped on a placeholder.

Here is a basic implementation of a target accepting only Storage Items:

<Grid x:Name="TargetGrid" AllowDrop="True" DragEnter="TargetGrid_DragEnter" Drop="TargetGrid_Drop">
    ...
</Grid>
private void TargetGrid_DragEnter(object sender, DragEventArgs e)
{
    e.AcceptedOperation = e.DataView.Contains(StandardDataFormats.StorageItems)
        ? DataPackageOperation.Move : DataPackageOperation.None;
}

private async void TargetGrid_Drop(object sender, DragEventArgs e)
{
    if (e.DataView.Contains(StandardDataFormats.StorageItems))
    {
        var items = await e.DataView.GetStorageItemsAsync();
        e.AcceptedOperation = DataPackageOperation.Move;
    }
}

With the above scenario, we just scratched the surface of how you can use drag and drop in your app. For more advanced scenarios with drag and drop, head over to GitHub for the Drag and drop sample.

Wrapping up

That completes week 7 of our Windows 10 by 10 development series. Our DVLUP challenge this week is: Make Your Apps Cooperate with Cross-App Communication, be sure to check it out to claim points and XP for implementing the new cross-app communication features.

For the remaining three weeks in the series, we will cover more a few more general app development topics, such as design, performance, and security, so be sure to come back for that.

We’re looking forward to seeing how you can make your apps work better together, so do let us know what you think on Twitter via @WindowsDev and #Win10x10!

Additional Resources:

Special thanks to Arun Singh, Anna Pai and Alain Zanchetta for writing the content this article was based on and Stefan Wick, Hector Barbera, Howard Kapustein, Abdul Hadi Sheikh, Jill Bender and Jon Wiswall from the Windows engineering team for providing technical guidance and review.

What’s next for Windows 10 IoT Core

$
0
0

Back in early August I was pleased to announce the Windows Insider release of Windows 10 IoT Core, a version of Windows 10 targeted towards small, embedded devices that may or may not have screens, and the response from you has been tremendous. We’ve received a lot of feedback that has helped us shape the next update and I’d like to share some of that detail with you.

What we’re doing in this upcoming Windows Insider release can be broadly described as 3 buckets: Responding to your feedback, improving security, and expanding development choices.

Your feedback on Windows 10 IoT Core has been tremendously influential in improving the quality and completeness of this release, and we’ll be including many of the changes and requests that you have made, such as adding support for pulse-width modulation (PWM) and analog-to-digital converters (ADC) via an integrated and extensible provider API, addressing issues around the USB HID class driver, and many bug fixes. We also saw how popular the web-based device management interface is with customers, so we’re continuing the investment in it and delivering new functionality to change the device name, password and the ability to start processes.

We are committed to delivering a highly secure platform for you to build IoT applications upon, and we’re going to continue that commitment in upcoming releases. We summarize our IoT security goal as bringing Windows’ “enterprise grade” security to IoT, devices and you’ll soon see Secure Boot and Bitlocker encryption available in the IoT Core builds. By building this into IoT Core you can get these highly valuable security features without needing to build your own implementations meaning you can get your project done faster and still be more secure.

With Windows 10 IoT Core being part of the Windows family, it already offers Universal Windows Platform’s (UWP) rich programming model and language support. That said, we have seen a great deal of enthusiasm for using Node.js in IoT projects, so we’re investing to improve the experience for you on IoT Core with a single installer for all Node.js components, support for the Node.js ‘Serial’ and ‘Cylon’ robotics framework libraries, and even a ‘Cylon’ project template for Visual Studio.  See our recent blog post on the updates.

Windows 10 IoT Core is available through Windows Insider Program which will also give you access to all the Windows Insider releases of Windows, not just IoT Core, and you’ll be automatically notified when a new release becomes available. You can also go to WindowsOnDevices.com and follow the steps there to get the release.

Windows IoT Core Starter Kit

We’re proud to announce that we are partnering with Adafruit to release a new Starter Kit designed to get you started quickly and easily on your path of learning either electronics or Windows 10 IoT Core and the Raspberry Pi 2. This kit is available now at http://www.adafruit.com/windows10iotpi2 and includes a compatible set of sensors, electronic parts, wires, and cables that have been verified to work with Windows 10 IoT Core. It also has an SD card preloaded with Windows 10 IoT Core meaning you can start right away. The kit comes with getting started instructions and sample code for projects that you can make. For more information head over to WindowsOnDevices.com.

1_iotKit

We’re excited about this kit and will be featuring it in our booth at the World Maker Faire in New York on 26th & 27th of September. Our booth is located near Zone 3, on the grass lawn between Rocket Roundabout and the Make: Electronics stage and you’ll get to see a bunch of cool Windows maker projects. We’ll also be hosting the US winner of the Hackster.io “Hack the home” hackathon in our booth. This hackathon was a huge success over 250 high-quality submissions. This is even more impressive when the timeline is considered. The top submissions received their hardware from Hackster.io in early September and had to make their final submissions on a few short weeks later. The North American winner was Philippe Libioulle of Quebec City, Canada and you can learn more about this cool project here. We’re also hosting the European winner Christian Kratky of Kamp-Lintfort, Germany at the Rome Maker Faire in October. Their awesome “hack the home” project can be found here. The winner of the Gift Certificate was Anurag S. Vasanwala of Surat, India and you can get details on the project here.

To get this latest release you should join the Windows Insider Program or download directly from WindowsOnDevices.com. We hope to see you at World Maker Faire, and we can’t wait to see what you make.

Lumia Imaging SDK 3.0 now available with UWP support

$
0
0

Lumia Imaging SDK, a popular toolset that Microsoft also internally uses to implement some of its imaging apps, has been updated to version 3.0. Previous versions of the SDK have already powered applications with a total of over 100 million downloads and now has support for Windows 10 UWP (Universal Windows Platform) to target smartphones, tablets and computers running Windows 10. In addition to Windows 10, development for both Windows 8.1 and Windows Phone 8.1 platforms continues to be supported. The SDK is implemented as Windows Runtime Component, allowing its APIs to be called from applications written in C#, C++, JavaScript and Visual Basic. To get started with Lumia Imaging SDK 3.0 development for Windows 10, install the SDK using NuGet Package Manager straight in Visual Studio or download the package from nuget.org

The key feature introduced in Lumia Imaging SDK 3.0 is support for GPU based image processing through Direct2D. For most applications, this leads to significant performance improvement compared to the same application implemented with an earlier CPU-only version of the SDK. Where possible, exact implementation details of GPU support have been abstracted away from the API so that majority of the developers don’t need to be aware of what’s happening under the hood.

Another focus area in the 3.0 release is interoperability with other Windows 10 APIs: rendering to SwapChainPanel is supported, and Direct3DSurface, SoftwareBitmap and WriteableBitmap can be used both as image sources as well as rendering targets. With its high abstraction level and wide range of features, Lumia Imaging SDK 3.0 complements other Windows imaging APIs like Win2D and Windows Imaging Component (WIC).

As a concrete example of API interoperability, here’s how output from Lumia Imaging SDK 3.0 can be directed to a UI element using SwapChainPanel in just few lines of code. First, we define a XAML page with SwapChainPanel element named “m_targetSwapChainPanel”:

<Page
    x:Class="WindowsBlogSample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WindowsBlogSample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <StackPanel Margin="5,5,5,5">
            <SwapChainPanel Width="800" Height="600" Name="m_targetSwapChainPanel"/>
        </StackPanel>
    </Grid>
</Page>

With the SwapChainPanel UI element defined, we can now render directly to it by attaching a SwapChainPanelRenderer and calling RenderAsync:

var imageStorageFile = await KnownFolders.PicturesLibrary.GetFileAsync("Sample.jpg");

using (var source = new StorageFileImageSource(imageStorageFile))
using (var contrastEffect = new ContrastEffect(source) { Level = 0.6})
using (var sharpnessEffect = new SharpnessEffect(contrastEffect) {Level = 0.2})
using (var renderer = new SwapChainPanelRenderer(sharpnessEffect, m_targetSwapChainPanel))
{
    await renderer.RenderAsync();
}

Image pair below shows the original image and processed result:

1_lumiaImageSdkUnchangedImage 2_lumiaImageSdkSharpenedImage

To get started with Lumia Imaging SDK 3.0 development for Windows 10, install the SDK using NuGet Package Manager straight in Visual Studio or download the package from nuget.org. Remember to also check out SDK repository on GitHub for sample projects and snippets of useful open source code! SDK documentation is available online at MSDN.

Have fun with the SDK!

Windows 10 development for absolute beginners

$
0
0

The absolute beginners series is back for Windows 10.  It doesn’t matter if you’re a pro dev or just starting out, there’s valuable content for everyone.  If you’re looking for a faster pace content that dives deep, the Developer’s Guide to Windows 10 series may be for you.  The only thing that the absolute beginners series assumes is that participants understand the basic language fundamentals of C#; if you don’t have this covered, you should take a look at the C# Fundamental series first.

Your guide through the series, Bob Tabor from http://www.learnvisualstudio.net/, walks you through how to create Windows 10 apps on the Universal Windows Platform (UWP) – meaning you’ll gain access to all the Windows 10 screens: PCs, phones, tablets, and even on a Raspberry Pi, HoloLens, and Xbox.  Bob will challenge you with exercises, help you build a reference sheet for future reference, and explain the techniques and concepts being used along the way in a simple, friendly manner.  The series source code for each video is at https://github.com/Windows-Readiness/AbsoluteBeginnersWin10.

The curriculum is laid out around in two major parts. The first part will teach you the skills to build basic apps.  The second part you’ll create of four separate full blown apps: soundboard, weather, an album cover matching game and a hero explorer app. We recommend those new to the platform start at the beginning.  But for those already familiar, here are direct links to the sections you are likely to find most helpful.

  1. Soundboard (Video 49) This first sample app plays funny sounds when the user taps a given tile.  The UWP Soundboard app will allow us to create an app allowing the user to filter the sounds by category, a search feature to find a sound quickly, databinding, working with the media element, drag and drop when using the app in desktop, and the process of submitting the app to the Windows Store.
  2. Weather (Video 57) This second sample app focuses on making calls to external web services to retrieve data from a third-party web service, deserializing the JSON returned from the call into an object graph of classes generated by an online tool, working with Location services, adding capabilities to apps, debugging location using the Phone Emulator’s map and location feature, and more.
  3. Album Cover Match Game (Video 63) This third example demonstrates how to access known folders like documents, images and music.  The application traverses a folder structure to find all .mp3 files, reads the meta data about each file including the album art, and randomly chooses files to play.  The example makes extensive use of ObservableCollection<T>, databinding and data templates.  This app demonstrates the use of a storyboard used to stop and start music and perform the count down, game logic and scoring, advanced use of the Progress Bar and more.
  4. Hero Explorer (Video 71) The final example allows the user to explore Marvel Comic’s universe of characters via their programmatic API.  The application makes calls by create an MD5 hash of a public and private key as well as a timestamp to authenticate the call.  The app will deserialize JSON data into an object graph of classes, shows how to overcome inevitable failed calls to web services through the use of exception handling, async, await and Task, and makes extensive use of ObservableCollection<T> to allow results to stream into view.  Finally, the example demonstrates how easy it is to include Cortana integration into your app.

We hope you enjoy the series and if you are looking for examples on how to do certain tasks, please reach out to us via the comments or @WindowsDev.

Adding polish to improve the look and feel of your app (10 by 10)

$
0
0

Designing an app isn’t about patterns or controls—it’s about creating a great experience for your users, every time. While you’re designing with the optimal user experience (UX) in mind, you also have to think about using color effectively, implementing usable controls, and understanding what should and shouldn’t be in the app. On top of that, of course, you need to make the app work on multiple devices with multiple sizes, whether it’s a phone, tablet, or desktop device.

Snap to the grid

The grid is where it all starts. It’s the foundation of app design, and it’s meant to guide each step of your design. The base 4-pixel grid serves a very important purpose: it helps you keep your design elements lined up, orienting the user to what’s visually important. You can find out more about the importance of grid in this MSDN article.

The grid also allows you to scale your design elements consistently across multiple display sizes. To avoid decimal numbers when your UI scales up or down, you should ensure that any guides in your grid layout are based on a number that’s divisible by four. To make your designs as crisp as possible, snap them to the grid. In the example below, you see what happens when your design elements map to a 4×4-pixel grid: the element or image will always have sharp and crisp edges.
1_snappingToGrid

By contrast, when you don’t snap to the grid, your design elements will have blurry and soft edges on some devices, like this:
2_notSnappingBlurry

Alignment

Images and text to the grid

If your app uses horizontal alignment of icons with text, the best approach depends on the icon size and amount of text.

Where multiple or single lines of text fit within the height of the icon, we recommend the text be vertically centered. Once the height of the text extends beyond the height of the icon, the text within the height of the icon should then align vertically and additional text should flow naturally below. Here is an example of how that looks:
3_aligningWithTypography

Aligning circles and typography

If you’re using circles with typography, you need to make sure the two align properly. The samples below show the best ways for both horizontal and vertical alignment:
4_aligningTypographyVertical

Be bold with color

One of the easiest and most impactful ways you can differentiate your app is by choosing the right colors. The palette you decide on can be a huge factor in making your app attractive and user friendly.

Look at the striking use of bright yellow contrasted with black in the example below. The yellow very simply, yet effectively, highlights a selected area:
5_contrast

The following example shows an effective use of bold color, as well as good contrast between the primary hue and the background.
6_realAppContrast

Color selection basics

Typically, you’ll start with a primary color in your app, and an accent color that you can use for things like Start, Taskbar, and hyperlinks in the common controls. Once you’ve selected an accent color, light and dark shades of the accent color are created based on HCL values of color luminosity. You can use shade variations (see below, assuming we’ve selected red) to create visual hierarchy and to provide an indication of interaction across your app.
7_colorSelection

Contrast

In terms of color and contrast, typography should always be distinct from the background color. However, too much contrast can be hard to read on digital screens. As you can see in the below example, white and light background colors make the foreground color much easier on the eyes—and easier to distinguish.
9_contrast

Color contrast is especially important when designing for multiple devices and accessibility. A contrast ratio of at least 4.5∶1 is best, and a ratio of 7∶1 provides optimal legibility for content. The following tools and sites can help you check your color contrast:

Colour Contrast Analyzer is a helpful tool for checking contrast. Using this tool, you can sample the foreground and background color and use the results to define your color contrast ratio.

When color and contrast aren’t used properly, the results can be extremely hard to read. The examples below show some good uses of contrast, along with problematic ones (marked with diagonal lines).
10_goodAndBadExamplesOfContrast

Color themes

In general, a light theme works very well for productivity-centric apps. By using a light theme, you make it easier to read long blocks of text over a prolonged period of time.

A dark theme, meanwhile, provides a visible contrast for apps that are more media-centric, or in scenarios where users are presented with a lot of video or image-based content.

Taking our red accent color, these would be the light and dark themes options for our app:
11_colorTheory

And as you build out your UX, keep in mind that black, white, and grey generally go with everything. Even well-placed bold colors can work wonders against black, white, and grey, as you can see here on the Microsoft home page:
12_microsoftHomePage
Here’s another example:
13_newSample

If you’re looking for inspiration, there are many free color palettes to choose from online, such as https://color.adobe.com and COLOURlovers.com, a community where people create and share their own palettes. Other excellent sites for swatches and schemes are Coolors and Palleton.

Simplify your user flow

Navigation elements help users get to the content they want, but they can also take up space that your app could otherwise use for content. That’s why it’s critical that you spend some time considering your app’s flow and use the navigation elements appropriate for your app’s structure. Below are three ways you can use navigation elements to improve your app’s overall user flow:

  1. Tabs and pivot You can use tabs and pivot when you want to display a persistent list of links to pages at the same level, such as in an app that app has between 2–5 pages, or where you expect a user to frequently switch between pages. One tab wouldn’t sense and more than 5 would make things crowded. A good example of tabs and pivots in action is a restaurant-finding app:
    14_pivot
  2. Nav pane A nav pane displays a list of links to top-level pages. This is a good choice when you don’t expect users to frequently switch between pages, when you want to conserve space (at the expense of slowing down navigation since a user has to expand out the control), or when most of your app’s pages exist at the top level. This smart-home app uses a simple, attractive nav pane:
    15_navPanel
  3. Master/details Lastly, let’s quickly touch on an app UX primarily driven on a list, or master view, of item summaries. In this type of data-driven app scenario, a user selects an item and displays its corresponding data elements on an items page in the details section in the app. On a smaller screen, this items page would replace the master view, while a larger screen would display them side-by-side. It’s a good idea to use this element when you expect users to frequently switch between child items, or when you want to enable the user to perform high-level operations like deleting or sorting on individual items. This stock-tracking app shows how a master/details pattern creates a good, attractive user flow:
    16_masterDetail

To learn more about effective use of these navigation elements (and many more!), visit the Windows UI navigation basics pages for an in-depth discussion of topic.

Making your design responsive

Since your app will likely need to flow across different devices and multiple sizes, you should always be thinking about adaptive/responsive design. We covered this in depth in a recent 10×10 blog, which is worth checking out.

To help make responsive design seamless, Windows 10 adds the VisualStateManager and a number of new controls. By taking advantage of these controls, and the Universal Windows Platform’s built-in features, building blocks, and responsive design techniques, you’ll be able to create a UI that looks great on any device.

For additional information, explore the Design basics section of the Windows Dev Center.

Wrapping up

Remember, many users will base their judgment of the overall usability and quality of your app primarily on the design – often formed in the first minute or two of use. No matter what stage of development you’re in, it’s always worth finding some time to polish your design, whether it’s through focusing more on snapping to the grid or sprucing up your color and animation. You can find some additional design guidelines, as well as Illustrator templates, at https://dev.windows.com. You might also check out Smashing Magazine, a great source for good visual design info.

With week 8 of our Windows 10 by 10 development series wrapped up, we hope you try the DVLUP Quiz challenge for design and earn XP and points. Next week, we’ll continue the theme of app tuning by looking at how to better secure your app.  For now, head on over to DVLUP or reach us on Twitter via @WindowsDev and #Win10x10 in the meantime, telling us your top design tricks for making your app great.

Optimizing your XAML app for performance (10 by 10)

$
0
0

Over the past few weeks, we’ve highlighted a number of compelling new platform capabilities in our Windows 10 by 10 development series that you can implement in your Windows 10 apps to provide a better experience to your users. One of the important things to always take into consideration is app performance. Here are some tips to improve app performance in Windows 10 apps.

1.      Recompile your apps for Windows 10

The first thing to be aware of is that a lot of performance work has been done in Windows 10 to improve apps that are simply recompiled for Windows 10. To illustrate, take a look at this comparison for a few apps that showcases the improvements by simply recompiling:

 1_memUsage  2_startupTime
Memory usage Start up time

For more guidance on how to move from Windows Runtime 8.x to UWP, check out the MSDN documentation.

2.      Use the Visual Studio profiler to measure and track performance

At the core of performance optimization of Windows 10 apps is the Visual Studio Profiler. To use the profiler, go to Debug à Profiler à Start Diagnostic Tools Without Debugging… from the Visual Studio 2015 menu or simply hit Alt+F2.

3_visualStudioProfiler

The profiler will give you valuable information regarding your UWP app’s performance with these five tools:

  • Application Timeline
    • Examine where time is spent in your app. Useful for:
      • Correlating user actions with application activity so you can filter to applicable time ranges for trouble spots
      • Troubleshooting timing issues like low frame rate
  • CPU Usage
    • See where the CPU is spending time executing your code. Useful when the CPU is the performance bottleneck
  • GPU Usage
    • Examine GPU usage in your DirectX app. Useful to determine whether the CPU or GPU is the performance bottleneck
  • Memory Usage
    • Investigate app memory to find issues such as memory leaks
  • Network
    • Examine information about each network operation in your app, including HTTP request and response headers, payloads, cookies, timing data and more

These tools will capture traces in their respective areas to help you analyze your app’s performance. With the exception of Memory Usage, the tools can be combined to capture data simultaneously, which can then be correlated over multiple areas of interest.

4_profilerInAction

In the above example, you can see the diagnostic traces captured on the Application Timeline, including CPU and GPU usage. At the top, there’s UI thread utilization, which provide colored bar charts that relate to the stages of XAML drawing (parsing, layout and render), I/O performance and the app code execution. At the bottom of the screen, the exact events that occur and associated durations are shown. With this, you can quickly see what is causing slowdowns in your app and identify areas for further investigation. For example, a lot of long orange Layout executions might indicate drawing a lot of items on screen, which may point to virtualization not being applied (read on for further details on virtualization).

Doing a memory analysis will provide us with a good idea of how much memory the app is using over time. This can indicate memory leaks (if memory keeps increasing over time without decreasing) or give us pointers on where to optimize for memory usage by using smaller images for example (read on for further details on image and text optimization).

5_profilerMemory

To learn more about the new profiling tool in Visual Studio 2015, read the in depth blog post by the WPF team.

3.      List UI Virtualization

A common app scenario is displaying a list of items for users to browse a collection. These lists can grow very large, which can lead to poor performance. By default, the ListView and GridView controls support UI virtualization of the elements in the list. In short, UI virtualization means that only the items that are visible on screen, plus a small window of adjacent items, are created graphically. The process of expanding a DataTemplate and assigning it values from the data list is called realization. Schematically, virtualization looks like this:

6_virtualizedList
Source: ListView basics and virtualization concepts (Alain Zanchetta)

Additionally, UI virtualization also ensures that realized items are recycled when users scroll in the list. This means that the created elements are reused, populated with new data, and then displayed again. This saves the cost of having to destroy and recreate the visual elements, which greatly improves performance.

As mentioned, UI virtualization is generally something you don’t have to worry about, as it’s enabled in the controls you’ll generally use for displaying lists: ListView and GridView. Make sure you keep these two things in mind when using ListView and GridView, which can cause UI virtualization to break:

  • When you place either of these panels inside of a ScrollViewer. A ScrollViewer’s behavior tells its child elements to not worry about their height and to take as much space as they need. This will result in the ListView/GridView being completely expanded which breaks the UI virtualization behavior, as all items will be realized.
  • The layout behavior of ListView/GridView can be changed by changing the ItemsPanel Template. The items panel is responsible for the UI Virtualization, so when swapping or modifying that panel, make sure you use panels that support virtualization, such as VirtualizingStackPanel and ItemsWrapGrid, so the list will maintain its UI virtualization behavior.

For more details take a look at the “ListView and GridView data virtualization” documentation on MSDN.

4.      Image rendering optimization

Images can be a large contributor to your app’s memory usage. While it’s often easy to pack high resolution images with your app, or download high resolution images from the web for usage in the app, it can result in poor performance (from both a memory and network perspective). The best way to improve this is to supply images in multiple resolutions and sizes, optimized for the various parts of your app. For example, a list should probably use a small/low resolution image, while a full-bleed background image requires a large/high resolution one.

For customers supplying a stream to the BitmapImage (or BitmapSource), be sure to use the SetSourceAsync method rather than the SetSource method.  As its name implies, SetSourceAsync does its decoding asynchronously on background threads, rather than blocking the UI thread, and will save you valuable CPU time.

Decoding your images to an optimal size is also very important for performance.  In previous versions of Windows, images were decoded to their natural size, which might not match the actual size on screen, and use extra memory and CPU.  This problem was previously addressed by using the DecodePixelWidth/DecodePixelHeight properties to specify the size to decode the image to.  Starting with the Spring update of Windows 8.1, this is no longer necessary in most scenarios.  Windows will now automatically compute the render size of the image and decode the image to that size.  Note that if you are creating your images and calling SetSourceAsync on them before they are added to the XAML tree, this optimization does not apply and using the DecodePixelWidth/DecodePixelHeight properties is a good idea.

5.      Ensure your text is on the fast path

With Windows 10, text rendering has also been optimized out-of-the-box, to render up to 50% faster than before. This behavior can be affected by certain properties on a TextBlock, however. To debug this, use the DebugSettings.IsTextPerformanceVisualizationEnabled debug setting in your app. Text that has optimization applied will show up in green:
7_textPerformance

Keep in mind that this overrides the color of the text, so any text that you have defined as being green may appear as a false positive. The XAML for the above example looks like this:

<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap" Margin="0,0,0,10" Text="For any text, it [...] snap to.)" />
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap" Margin="0,0,0,10">
    <Run>
        Both word and selection segments are language-specific [...] used.
    </Run>
</TextBlock>

As you can see, placing the text in a child Run block instead of directly in the Text property breaks the text rendering optimization behavior. This is true for all inlines including <Hyperlink/>, <Bold/>, <Underline/>, <Italic/>, <LineBreak/>, <Span/>, <Run/>. Some other properties that cause this to happen are:

For more on TextBlock performance, head on over to the documentation on MSDN.

6.      Reduce the size of the Visual Tree

The size of the visual tree in XAML will directly affect both the startup time of the application and its memory usage. Let’s take a look at how we can optimize our app by making sure we don’t create anything in the Visual Tree that we don’t yet need to render.

The easiest way to see your element count is with the Live Visual Tree window in Visual Studio 2015.

8_visualTree
The number to the right of each element is the number of children that element contains.

A common pattern when building Windows apps is MVVM (Model-View-ViewModel), and a very common practice is to use a “Boolean to Visibility” converter to show/hide elements based on properties in the ViewModel. If you’re not familiar with this pattern, this basically allows us to toggle the visibility of items on the page by simply setting a property on it’s associated “controller” class.

While setting the Visibility of elements to Collapsed certainly hides the element from the view, it doesn’t prevent the item from actually being realized. This means that we still spend time in the Layout phase and thus slow down the start-up of our app. As a general rule of thumb, think of every 1000 elements being created in the tree as adding 1 second to your app’s start up time. This may sound like a large number, but a list of items that has a reasonably complex DataTemplate can quickly add up to a multiple of that.

New in Windows 10 is the x:DeferLoadStrategy attribute, which you can use to lazily realize elements when they are first needed. This saves our visual tree from being populated with items that are Collapsed to begin with and we can use these ways to realize them:

  • Call FindName with the name that was defined on the element
  • Call GetTemplateChild with the name that was defined on the element
  • In a VisualState, use a Setter or Storyboard animation that is targeting the deferred element
  • Target the deferred element in any Storyboard
  • Use a binding that targets the deferred element

Going over the places in your XAML where you have a Visibility of Collapsed defined is usually a good strategy to consider places where x:DeferLoadStrategy can be useful.

7.      Data binding optimization

Another thing heavily used when writing XAML apps is data binding. Data binding provides an incredibly powerful and productive way of writing code, especially when combined with the MVVM pattern mentioned earlier. Data binding has been greatly improved with Windows 10 and the way it works has been revamped. Using the new {x:Bind} markup extension for data binding results in compile time code generation for data binding purposes.

<DataTemplate x:Key="VacationsListViewItemTemplateOptimized" x:DataType="local:IItem">
    <TextBlock x:Name="titleTextBlock" Text="{x:Bind Title}" />
</DataTemplate>

The two changes in data binding markup you’ll need are displayed above. First of all, you need to specify an x:DataType attribute, as the code generation results in strongly typed code. Secondly, use the new {x:Bind} markup extension to do the binding versus the previous {Binding} markup. This also results in code that’s better debuggable, as the data binding code is now in the .g.cs file associated with your XAML page. Be aware that the data context is automatically set to the page itself, so all properties on the page can be bound against.

There are many more improvements made with the new {x:Bind} markup extension, so take a look at the x:Bind sample on GitHub to dive into things like x:Phase, which you can use to specify the order of realization of elements in a DataTemplate when panning lists.

Wrapping up

We hope this article provides you with background and practical guidance on how to approach optimizing your app’s performance. Head on over to DVLUP to take the “Use Visual Studio Profiler to keep your app running at peak performance” quiz to show off your knowledge of XAML performance optimization and claim some coveted points and XP. As usual, there are additional resources listed below and reach out to @WindowsDev on Twitter using #Win10x10 to chime in on the topic.

Resources


New advertising features and walkthrough of using Microsoft ads and mediation

$
0
0

Dev Center has now integrated the functionality previously available in pubCenter to simplify how to create, manage and track your Microsoft advertising ad impressions and revenue. In addition, Microsoft Advertising and Windows ad mediation have been merged into one single SDK, the Microsoft Universal Ad Client SDK, which works for apps built for Windows Phone 8.x, Windows 8.x and Windows 10.

These changes make Dev Center the single portal for all your advertising management as well as app management needs, so you now use Dev Center to:

  1. Promote your app using Microsoft Advertising
  2. Monetize your app using the Microsoft ad control and using ad mediation
    1. Update your app to use the latest version of the Microsoft Universal Ad Client SDK
    2. Create ad units
    3. Add video Interstitial ads
    4. Add ad mediation
    5. Make changes needed for existing apps
    6. Add Microsoft ads to apps using non-managed code (e.g. C++)
    7. Use ads in Windows 8.0 and Windows Phone 8.0 apps
    8. Selecting an ad size for your apps
  3. View ad impressions and ad revenue reporting
  4. Configure the ad targeting to support COPPA requirements

There are some differences to using Dev Center to manage ads vs pubCenter, so I’ll walk through how you now manage ads in Dev Center, and I will also describe three new features released this week:

  • Enable auto-update of the Microsoft Ad SDK
  • Updates to ad mediation: new ‘ranking’ ordering and new SDK timeout parameter
  • Two new ad networks added to mediation: AdDuplex for UWP (Windows 10) packages, and adding Vserv for Windows Phone 8.1

1. Purchase ads to promote your app

Dev Center allows you to promote your app and drive installs using the “Promote your app” feature under the Monetization section of the app menu. To set up your ad(s), click “New campaign”, to design your ad, select your target audience, and set a monthly budget. Your campaign will then run at the set monthly budget until you pause or cancel it in Dev Center.

1_promoteYourApp

There are two types of ads you can create through ‘Promote your app’:

  • Paid ads that show in Windows apps with the Microsoft Ad SDK
  • Free house ads that show only in your own Windows apps

2. Configure ads and ad mediation, using the Microsoft Universal Ad Client SDK

The Microsoft Universal Ad Client SDK allows you to show ads in your app, and thus generate ad revenue. The Microsoft Advertising SDK and ad mediation SDK are both incorporated into one SDK.

The Microsoft Ad SDK works for all versions of Windows Store apps (8.0, 8.1 and UWP apps), and supports three capabilities:

  1. Show banner ads
  2. Show video interstitial ads (8.1 and 10 only)
  3. Manage mediation, i.e. show ads from third-party ad networks

This new all-in-one SDK is designed to be simpler to use, though it does work slightly differently from previous Microsoft Ad SDK versions.

Here are the core steps to adding banner ads to a managed app (e.g. C#/XAML):

  1. Download the Microsoft Universal Ad Client SDK.
  2. In the XAML designer, drag the “Ad Mediation control” from the “Universal” section into your app. There’s no need to create an ad unit or create a pubCenter account.
    • When creating UWP apps you might see 2 controls (the new Universal and the previous Windows 8.1 version). The control to use is the one in the “Ad Mediator Universal” section.
  3. Adjust the Width and Height of the Ad Control so it is one of the supported ad sizes.
    2_adMediatorInVisualStudio

That’s all. There’s no need to create a pubCenter account or manually track which ad unit is associated with which app, or create ad units for different ad sizes. Dev Center will automatically create the ad units and add them to your Dev Center account. As the ads show in your app, revenue will be accumulated and paid out to you at the end of each month. Dev Center will show the ad views and ad revenue in the “Advertising performance” report for each app.

If you only want to use ads from Microsoft Advertising, you don’t need to do anything else. If you choose to use ad mediation to manage multiple ad networks and increase fill rate and revenue, you will need to add the different ad networks and configure them. See section “Add ad mediation” below for more details.

Below I will walk through scenarios that require some different steps:

    1. Update your app to use the latest version of the Microsoft Universal Ad Client (NEW) Every few months there is an update to the ad SDK that provides new capabilities, fixes bugs and/or improves performance. To use the new capabilities, you had to download the SDK, install the code, and recompile and resubmit.
      Starting today, this is no longer needed for UWP packages. With the release of the latest SDK update, the ad SDK is managed as an OS component, and gets updated automatically by the OS as long as there are no API or ad SDK behavior changes.This means that your apps will always utilize the most up-to-date, highest performance Microsoft Ad SDK. To take advantage of this capability:Download and install the Microsoft Universal Ad Client SDK.Rebuild and resubmit your UWP app.If you’re already using the Microsoft Universal Ad Client SDK, open your existing project and re-run the Connected Services to get the latest adapters (which are downloaded automatically from NuGet).For more information on the Microsoft Universal Ad Client SDK, view the MSDN documentation.
    2. Create ad units
      The new Microsoft Ad control does not require the manual creation of ad units, it is done automatically. However, there are still two scenarios where you will need to create a manual ad unit:
      • Using video interstitial ads
      • Using older version of the ad SDK for previously created apps (and you don’t want to update the app to the latest version of the Ad SDK)
      • Native and HTML/JavaScript apps

      To manually create ad units in Dev Center, select the “Monetize à Monetize with ads”, menu and click the “Show options” link under “Microsoft advertising ad units”.
      3_devCenterWhereAreAdUnits

      Then define a name for your ad unit, select your ad type, and specify the device family it will be used in. You’ll need to create a separate ad unit for each device family your app supports.
      4_AdUnits

    3. Add video Interstitial ads
      In addition to banner ads, video interstitial ads can be used to generate revenue through ads. Video interstitials are short video clips that take the full screen, and the app’s code determines when they are shown. This is a very useful solution for games that can show video between game levels. Video ads typically have much higher eCPM, at times generating as much as 10x the eCPM of a banner ad.Video ads require additional configuration and steps, as your code needs to detect the start and end of the video. To add video interstitials:
      1. Download and install the Microsoft Universal Ad Client SDK.
      2. Create an ad unit in Dev Center, add the reference to your VS project, and call the appropriate APIs – you don’t need to use the XAML designer.
        • This ad unit can ONLY be used for the video ad. For banner ads use the process described above.
      3. Add code to manage the instantiation, showing, and detection of success of video ads.
    4. Add ad mediation
      Ad mediation allows you to maximize your banner ad revenue by showing ads from multiple ad networks and reach almost 100% fill rate. To do this, you have to configure ad mediation in your project, and then modify the ad network order and parameters in Dev Center.Once your app has multiple ad networks, you can optimize your which ads show in which markets. For example, you can define that in one market, only Microsoft shows up, and in another market other ad networks should be shown first.To add ad mediation to your app:
      1. Download and install the Microsoft Universal Ad Client SDK.
      2. In the XAML designer, drag the “ad mediation control” into your app. There’s no need to create an ad unit or create a pubCenter account.
      3. Adjust the Width and Height of the Ad Control so it is one of the supported ad sizes.
      4. Set up accounts in each of the partner networks and create an ad unit.
      5. To configure ad mediation in your app, open Connected Services in Visual Studio, select the ad networks you want to use, and enter the required metadata.
      6. Test the app, and follow the ad mediation best practices.
      7. Submit the app.
      8. Modify the ad mediation configuration in Dev Center.

      Ad mediation can be configured by percentage (e.g. each ad network is chosen first in the waterfall x% of time), or new configured by order (e.g. ad network A is #1 in the waterfall, if it fails, then ad network B is #2, then ad network C, etc.). This new waterfall feature allows you to set ad mediation to call better performing ad networks ahead of others.

      Ad mediation is available for banner ads; it is not offered for video interstitial ads.

    5. Make changes needed for existing apps
      You are not required to make any changes to existing apps using a previous version of the ad SDK, but you might want to consider doing so to take advantage of the simplified ads-in-app management. If you choose to do so, you’ll need to remove all references to the previous ad SDK from your app before installing the Microsoft Universal Ad Client SDK.
      1. Uninstall all existing ad SDKs through the control panel.
      2. Download and install the Microsoft Universal Ad Client SDK.
      3. From your VS project(s), remove any existing ad reference(s).
        1. For 8.1 universal apps, you’ll need to remove from both Windows and Windows Phone projects.
      4. Re-add reference(s) to the latest SDK.
        1. For Silverlight only (Windows Phone 8/8.1):
          1. Reference the Ad Mediator, then visit Connected Services to NuGet install the latest bits.
          2. If you previously used AdControl without mediation and wish to continue that way, you can now safely remove the AdMediator reference and just include those from Microsoft.Advertising.
        2. For 8.1 universal solutions: Re-add the reference in both the Windows and Windows Phone projects.
        3. If you’re using other SDKs through ad mediation, re-add the metadata through Connected Services.
      5. For Windows and Windows Phone 8.1 and UWP (except Silverlight), our code is now native so you must switch to use architecture-specific outputs.
      6. Code changes should not be required.  The exception is for Windows Phone 8.1 XAML only, in which you’ll need to modify any existing namespace references in code:
        1. Old: Microsoft.Advertising.Mobile.UI
        2. New: Microsoft.Advertising.WinRT.UI
    6. Add Microsoft ads to apps using non-managed code
      If your app is created using native code (e.g. C++), you will use the same Universal SDK, and access the same APIs. The only difference is that ad mediation is not available, only banner and video ads.
    7. Use ads in Windows 8.0 and Windows Phone 8.0 apps
      Windows 8.0 apps are not supported by the new SDK or any version of ad mediation. There is a previous Microsoft Advertising AdControl SDK that can be used, but the SDK is no longer updated. We recommend upgrading your app to Windows 8.1 or UWP to use the new ad SDK.For Windows Phone 8.0, follow the same instructions explained in this document for Windows Phone 8.1 and UWP apps, and make sure you run Connected Services to configure ad mediation before submitting the app.
    8. Selecting an ad sizefor your apps
      When adding the Ad control to your app, you have to select one of the supported sizes. The sizes for PC/tablet and phone are different, so be sure to select the size supported for the device where the app will run.
      Windows Desktop Windows Phone &
      Windows Mobile
      250×250*
      300×250
      728×90
      160×600
      300×600
      300×50
      320×50
      480×80
      640×100

      *The 250×250 size has limited demand, so we recommend selecting another size for maximum fill rate and eCPM.

      If you create a UWP that will run across PC and Phone, your app will have to select the size of the ad SDK appropriate for the OS that is running the app. There are several options to do this, including validating the screen size, have a package for each OS, or check the OS at runtime by checking the Device Family.

3. View ad impressions and ad revenue reports

The integration of pubCenter into Dev Center brings some additional reporting capabilities, including reporting by app rather than ad unit. Analyzing your ad performance is simple in Dev Center, but it does work differently than in pubCenter. To view the new reports in Dev Center, follow these steps:

  1. Link your pubCenter account(s) to your Dev Center account
    • If you have one pubCenter account and one Dev Center account with the same Microsoft account, your data will automatically populate in the “Advertising performance” section of Dev Center without any action from you. Move to Step 2
    • If you have more than one pubCenter account, or use different Microsoft Accounts between the two, you need to link your accounts. See the Announcing the Microsoft Universal Ad Client SDK with support for video interstitial ads and ad mediation blog post from Microsoft Advertising for more details.
      5_perf
    • Once your accounts are linked, all your previously created ad units will now will be linked to your account and will appear under the correct app unless you used the same ad unit in multiple apps (see step 3).
  2. View ad performance at the account level
    • From the left hand navigation menu on your Dev Center dashboard, select “Advertising performance”. You’ll see same reports available in pubCenter, with some minor variations due to time differences.
      6_perfGraph
  3. View ad performance at the app level
    • If you have been using one ad unit for each app or multiple ad units that only appear in one app, these ad units will automatically report under that app. You’ll see the total revenue for that app, or you can filter by ad unit.
    • If you have ad unit(s) that are used in multiple apps, Dev Center will not report the revenue from the ad unit(s) under the apps. You will still be able to view the revenue for the ad unit(s) by selecting the ad unit name you specified in pubCenter. Simply select the ad unit name from the main ad performance report at the account level.
      7_perfGraph2 8_perfGraph3
  4. View ad performance at the applevel
    • Advertising revenue appears in the “Payout summary” menu in Dev Center.
    • Payout will continue to be separate between apps and advertisement, though all payout reporting is shown in Dev Center

pubCenter will continue to be available for a few more months, to show the same reports and revenue information as you now can see in Dev Center. Once the Dev Center feature is fully functional, pubCenter will be closed down.

4. Configure the ad targeting to support COPPA requirements

The Children’s Online Privacy Protection Act (COPPA) compliance setting is now required for all apps using ads. COPPA requires developers using in-app advertising to indicate if their app targets children under 13, and advertising networks will then serve non-targeted ads in the app. If you have not manually selected a COPPA setting for your app, it is defaulted to the most appropriate value depending on the category of the app. You can view the default value or change this value under the “Monetization -> Monetize with ads” menu in Dev Center.

Developers may have other legal obligations under COPPA. You should review FTC’s guidance and consult with your legal counsel regarding COPPA obligations.

9_coppa

Integration of all the advertising capabilities into Dev Center is new, so please let us know if there are any issues (through support) or new features you’d like to see included in future releases (through user voice).

Windows Store Trends – September 2015

$
0
0

This blog is the latest in a recurring series about recent Store trends across categories, markets, and more. Understanding these trends can help you determine what types of apps to build or where to focus your development efforts.

With the launch of the unified Dev Center in April, we released the Windows and Windows Store trends page with much of the information we typically cover in this blog series. In an effort to provide you with new data to help you make even more informed decisions for all the apps you publish, we will focus this trends update on Windows 10.

Top Windows 10 trends:

  • Windows 10 Adoption: Windows 10, released July 29 and currently available for Windows PCs and tablets, and now account for more than 50% of all Windows Store downloads. Developing apps for Windows 10 now sets you up to be in the Store when the first Windows 10 mobile users begin upgrading this fall.
  • Windows Phone Update: Only notable changes for Windows Phone trends are highlighted here; see the Dev Center trends page for the full update.
  • Downloads by Category: Games is still the dominant category, and this month we include a drill down on Game subcategories.
  • Categories with Opportunity: Productivity has shot up to the number one category with opportunity for Windows 10 apps. An analysis of the opportunity within the Games subcategories is also shown.
  • Downloads by Market and Language: Brazil continues to climb in the number of downloads as well as percentage of total downloads, while Brazilian Portuguese has jumped to the number three spot in downloads by language, and Turkish and Dutch enter the top ten languages for the first time.

Windows 10 Adoption Trends

The release of Windows 10 on July 29, 2015 also brought the release of the unified Windows Store, a single place to find apps for all Windows 10 devices. This unified Store combines all linked apps as well as universal apps into one listing, so users can purchase an app once and it will work on all compatible devices. Windows 10 is available for PCs and tablets at this time, and over 110 million devices are currently running the software. The mobile version will be released this fall, with a Windows Insider preview version available now. We’ve separated Windows Phone and Windows downloads to allow for a more accurate OS version comparison.

App download by Windows OS Worldwide, September 2015

 1_wpGraph  2_winGraph

Windows 8.1 has been the most popular OS for both Windows and Windows Phone for the past year. However, Windows 10 is quickly establishing its presence in Windows Store traffic on PC and tablet (the green slice on the Windows chart).

In the few short months since release, Windows 10 users have made more than 1.25 billion visits to the Windows Store, and they account for more than half of the Windows Store downloads. For developers, Windows 10 translates into 2X the user engagement and 4X the revenue per user compared to Windows 8.x. Just as our large app partners are finding success on Windows 10, we believe it’s a good time to build and publishing a universal Windows 10 app – both to reach the growing audience on PC today, as well as the new Windows 10 devices coming this fall.

2015-10-12---First-2-months-IG

Windows Phone 8.x Store Update

This blog focuses on the trends we’re seeing in the Windows Store for Windows 10 apps, as the trends for the Windows Phone Store (and the Windows Store for 8.0 and 8.1) has not had any material changes and can be found on the Windows and Windows Store trends page. The majority of the trends are similar from past posts (April 2015, December 2014, September 2014). While we see some movement in the top five download categories, the actual percentage for each category has remained fairly stable. In-app purchases continue to make up the majority of sales in the Windows Phone Store, sales of paid apps are increasing and accounted for about 30% of sales in June 2015. Low-memory devices (under 1 GB) continue to account for the majority of Windows Phone users, and there are some new charts detailing user storage, screen size, and resolution that are worth considering as you develop apps in advance of the Windows 10 mobile release this fall.

Downloads Per Category

The Windows Store adjusted several of the app and game categories from the Windows and Windows Phones Stores, and introduced several new categories to allow more opportunities for app promotion. If you haven’t yet reviewed the new categories, take a look to ensure your app is in the most appropriate category.

The August 2015 download information provides the first insights with the new category structure. While Games is still the dominant category (see the graph below for more information), we see Entertainment, Photos & Video jump into the 2nd and 3rd spots for the first time, followed by Productivity and Utilities & Tools.

Windows 10 app downloads per category Worldwide, August 2015
3_downloads

August 2015 also provides a first look at which game subcategories are popular among Store customers. Action & Adventure games account for a quarter of all game downloads, followed by Puzzle & Trivia, Music, Racing & Flying, and Card & Board. Combined, these top five genres account for more than 70% of all game downloads. It’s important to note that while Word and Fighting appear on the bottom of the list, there are also very few apps in those categories.

Windows 10 app downloads per Games subcategory Worldwide, August 2015
4_gameDownloads

Categories with Highest Incremental Download Opportunity

Understanding which categories have the highest ratio of downloads per app can also be helpful. This is a function of total downloads versus total available apps in that category. For example, while Games is the most-downloaded category, Productivity has more downloads per available app.

Index of average number of downloads per app in each category from Windows 10 devices Worldwide, August 2015
5_categories

The categories have changed slightly from the Windows and Windows Phone Stores, but Games and Productivity are aligned with similar categories and remain in the top five, although we see Productivity with a huge jump to the number one spot. Photos & video is becoming an increasingly popular category, which is reflected in both downloads and opportunity. Security and Social remain in the top five, but we see Social fall from the number one spot to number four. If your goal is to reach the highest number of downloads possible, analyze these categories to understand which one presents the best potential for your apps.

The Games subcategory data also allows us to take a look at which subcategories have the most opportunity. Simulation and Racing & Flying are popular with customers, yet there are a limited number of apps available in each. As previously noted, the Word and Fighting subcategories have very few apps in them currently, which limit the number of downloads. There might be some opportunity in these subcategories even though they rank lower.

Index of average number of downloads per app in each Games subcategory from Windows 10 devices, Worldwide, August 2015
6_gameCategories

Downloads by Market

The Windows Store is currently available in 242 markets. As you build apps for Windows 10 and consider localization options outside your home market, examine these popular markets and which ones might be relevant to your app. We’ve shown the top 20 markets this quarter, so you can see which countries are early adopters of the new Windows Store. Countries falling into the “Other” category each account for less than 2% of Store downloads.

Index of average number of downloads per app by Windows 10 devices from Windows Store, by market Worldwide, August 2015
7_downloadByCountry

The United States is still the dominant market accounting for 17% of total downloads, and we see Brazil continues to climb in the rankings with over 5% market share. Other countries are also gaining significant share and should be strongly considered in your market selection.

Windows Store Customer Languages

Language is a key driver of downloads and adoption, and should be taken into consideration along with markets. For the first time, we see Dutch and Turkish enter into the top 10 languages, as Hindi and Cantonese fall out (note that we’ve increased the top languages shown to 12 this quarter). While the order has changed slightly on the other top languages, the actual percentage of their total downloads has remained fairly stable.

Primary language of Windows 10 customers in the Store Worldwide, August 2015
8_downloadByLanguage

Monetization Options

As mentioned in the Windows 10 adoption trends section above, Windows 10 devices currently account for more than 50% of Windows Store downloads and generate more than 4x the revenue per device than Windows 8. To maximize your revenue, it’s important to consider which monetization model(s) will work best for your app and customers: paid apps, in-app purchase, or in-app advertising (showing ads in the app). The Windows and Windows Store trends page offers details on customer purchasing trends in paid and in-app purchases.

In-app advertising continues to be one of the most profitable areas of revenue for developers, and the video interstitial capabilities recently released by Microsoft Advertising can significantly increase your fill rate and eCPM. If your Windows Phone apps generate revenue from in-app advertising, we encourage you to implement the new Microsoft Universal Ad Client SDK, which is compatible with Windows 8.x and Windows Phone 8.x apps as well as apps built on the Universal Windows Platform, supports banner ads, video interstitial ads, and incorporates ad mediation (i.e. show ads from multiple ad networks, including third parties).

For Further Analysis

We recommend taking some time to browse through the app catalog in the categories you want to develop for, and analyze the top apps in each category to see what makes these apps successful based on the trends data provided.

If you haven’t already, we also encourage you to begin developing apps for Windows 10. The Windows 8.1 code is designed to easily transfer to Windows 10 apps, and by developing and publishing apps now you’ll be able to capture both PC customers in the Windows Store as well as the first mobile customers this fall. We also recommend registering for the Windows Insider Program to gain early access to app developer tools.

We hope this data helps inform your decisions on investment areas for new apps and app updates. Please share your ideas for other data that could help you make investment decisions as you plan for your next apps and games.

Windows 10 SDK Preview Build 10563 Released

$
0
0

Today, we released a new Windows 10 SDK Preview and the associated Windows 10 Mobile emulators (Build 10563), to be used in conjunction with Windows 10 Insider Preview (Build 10565). The Preview SDK is a pre-release and cannot be used in a production environment. Please only install the SDK on your test machine. The Preview SDK Build 10563 contains bug fixes and under development changes to the API surface area. If you are working on an application that you need to submit to the store, you should not install the preview. The Preview SDK can be downloaded from the Windows 10 Developer Tools page.

We do recommend any uninstalling any preview SDK and emulators if you have it installed. This will prevent UI clutter in Visual Studio when choosing what emulator to target.

Start developing and @WindowsDev would love to see what you create. If you find bugs or issues, please leverage the Windows Feedback tool or MSDN forums.

What is new in SDK 10563

Emulator:

  • Updated the OS image included with the Windows 10 Mobile Emulator

SDK:

  • Corrected the signing of the Microsoft General MIDI DLS for Universal Windows Apps Extension SDK
  • Corrected the “No .natvis files found” error when you run Debugging Tools For Windows (WinDbg)” issue with WinDbg. See https://support.microsoft.com/en-us/kb/3091112 for more details.
  • Corrected the Windows Performance Analyzer crashes when ResidentSet graph is used
  • Corrected problem that prevented trace capture on pre-Windows 8 OS releases using xperf.exe and wpr.exe.
  • Corrected Windows Performance Analyzer crash when trying to modify the symbols inclusion/exclusion list in the Load Settings tab of the Configure Symbols dialog.
  • Improved Intellisense documentation for a large number of APIs.

Updated tests in the Windows App Certification Kit:

  • The “App prelaunch” test was enabled. This test proactively prelaunches and keeps apps in the background, verifying that the app handles the prelaunch scenario correctly.
  • The “App resources” test now runs correctly against UWA apps. This could result in failures not previously seen but for which the apps were always expected to pass.
  • The “Supported APIs” test no longer fails the app if the app invokes approved APIs by ordinals.

Changes in the Universal Windows Platform – Added

namespace Windows.ApplicationModel.Calls {
  public sealed class CallAnswerEventArgs
  public sealed class CallRejectEventArgs
  public sealed class CallStateChangeEventArgs
  public struct CallsVoipContract
  public sealed class MuteChangeEventArgs
  public sealed class VoipCallCoordinator
  public sealed class VoipPhoneCall
  public enum VoipPhoneCallMedia : uint
  public enum VoipPhoneCallRejectReason
  public enum VoipPhoneCallResourceReservationStatus
  public enum VoipPhoneCallState
}

namespace Windows.Devices.Printers {
  public sealed class Print3DDevice
  public struct PrintersContract
  public sealed class PrintSchema
}

namespace Windows.Foundation.Metadata {
  public sealed class PreviousContractVersionAttribute : Attribute {
    public PreviousContractVersionAttribute(string contract, uint versionLow, uint versionHigh);
    public PreviousContractVersionAttribute(string contract, uint versionLow, uint versionHigh, string newContract);
  }
}

namespace Windows.ApplicationModel.Activation {
  public enum ActivationKind {
    DevicePairing = 1013,
    Print3DWorkflow = 1011,
  }
  public sealed class DevicePairingActivatedEventArgs : IActivatedEventArgs, IDevicePairingActivatedEventArgs
  public interface IDevicePairingActivatedEventArgs : IActivatedEventArgs
}
namespace Windows.ApplicationModel.Background {
  public sealed class SensorDataThresholdTrigger : IBackgroundTrigger
}
namespace Windows.ApplicationModel.Chat {
  public sealed class ChatConversation {
    bool CanModifyParticipants { get; set; }
  }
}
namespace Windows.ApplicationModel.Contacts {
  public sealed class ContactCardOptions {
    IVector<string> ServerSearchContactListIds { get; }
  }
}
namespace Windows.ApplicationModel.DataTransfer {
  public sealed class DataPackageView {
    void SetAcceptedFormatId(string formatId);
  }
  public sealed class OperationCompletedEventArgs {
    string AcceptedFormatId { get; }
  }
}
namespace Windows.ApplicationModel.Email {
  public enum EmailCertificateValidationStatus
  public sealed class EmailMailbox {
    IAsyncOperation<IVectorView<EmailRecipientResolutionResult>> ResolveRecipientsAsync(IIterable<string> recipients);
    IAsyncOperation<EmailMailboxCreateFolderResult> TryCreateFolderAsync(string parentFolderId, string name);
    IAsyncOperation<EmailMailboxDeleteFolderStatus> TryDeleteFolderAsync(string folderId);
    IAsyncOperation<EmailMailboxEmptyFolderStatus> TryEmptyFolderAsync(string folderId);
    IAsyncOperation<IVectorView<EmailCertificateValidationStatus>> ValidateCertificatesAsync(IIterable<Certificate> certificates);
  }
  public sealed class EmailMailboxCapabilities {
    bool CanCreateFolder { get; }
    bool CanDeleteFolder { get; }
    bool CanEmptyFolder { get; }
    bool CanMoveFolder { get; }
    bool CanResolveRecipients { get; }
    bool CanValidateCertificates { get; }
  }
  public sealed class EmailMailboxCreateFolderResult
  public enum EmailMailboxCreateFolderStatus
  public enum EmailMailboxDeleteFolderStatus
  public enum EmailMailboxEmptyFolderStatus
  public sealed class EmailMailboxPolicies {
    bool MustEncryptSmimeMessages { get; }
    bool MustSignSmimeMessages { get; }
  }
  public sealed class EmailMeetingInfo {
    bool IsReportedOutOfDateByServer { get; }
  }
  public sealed class EmailMessage {
    IRandomAccessStreamReference SmimeData { get; set; }
    EmailMessageSmimeKind SmimeKind { get; set; }
  }
  public enum EmailMessageSmimeKind
  public sealed class EmailRecipientResolutionResult
  public enum EmailRecipientResolutionStatus
}
namespace Windows.ApplicationModel.Store {
  public static class CurrentApp {
    public static IAsyncOperation<string> GetCustomerCollectionsIdAsync(string serviceTicket, string publisherUserId);
    public static IAsyncOperation<string> GetCustomerPurchaseIdAsync(string serviceTicket, string publisherUserId);
  }
  public sealed class ListingInformation {
    string CurrencyCode { get; }
    string FormattedBasePrice { get; }
    bool IsOnSale { get; }
    DateTime SaleEndDate { get; }
  }
  public sealed class ProductListing {
    string CurrencyCode { get; }
    string FormattedBasePrice { get; }
    bool IsOnSale { get; }
    DateTime SaleEndDate { get; }
  }
}
namespace Windows.ApplicationModel.Store.Preview.InstallControl {
  public sealed class AppInstallItem {
    void Cancel(string correlationVector);
    void Pause(string correlationVector);
    void Restart(string correlationVector);
  }
  public sealed class AppInstallManager {
    void Cancel(string productId, string correlationVector);
    IAsyncOperation<bool> GetIsAppAllowedToInstallAsync(string productId, string skuId, string catalogId, string correlationVector);
    void Pause(string productId, string correlationVector);
    void Restart(string productId, string correlationVector);
    IAsyncOperation<IVectorView<AppInstallItem>> SearchForAllUpdatesAsync(string correlationVector);
    IAsyncOperation<AppInstallItem> SearchForUpdatesAsync(string productId, string skuId, string catalogId, string correlationVector);
    IAsyncOperation<AppInstallItem> StartAppInstallAsync(string productId, string skuId, bool repair, bool forceUseOfNonRemovableStorage, string catalogId, string bundleId, string correlationVector);
    IAsyncOperation<AppInstallItem> UpdateAppByPackageFamilyNameAsync(string packageFamilyName, string correlationVector);
  }
}
namespace Windows.ApplicationModel.UserDataAccounts {
  public sealed class UserDataAccount {
    string EnterpriseDataIdentity { get; }
    bool IsDataEncryptedUnderLock { get; }
  }
}
namespace Windows.Data.Json {
  public static class JsonError {
    public static JsonErrorStatus GetStatus(int hresult);
  }
}
namespace Windows.Devices.Bluetooth {
  public enum BluetoothAddressType
  public sealed class BluetoothDevice : IClosable {
    DeviceInformation DeviceInformation { get; }
    public static string GetDeviceSelectorFromBluetoothAddress(ulong bluetoothAddress);
    public static string GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice classOfDevice);
    public static string GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus connectionStatus);
    public static string GetDeviceSelectorFromDeviceName(string deviceName);
    public static string GetDeviceSelectorFromPairingState(bool pairingState);
  }
  public enum BluetoothError {
    DisabledByUser = 7,
  }
  public sealed class BluetoothLEAppearance
  public static class BluetoothLEAppearanceCategories
  public static class BluetoothLEAppearanceSubcategories
  public sealed class BluetoothLEDevice : IClosable {
    BluetoothLEAppearance Appearance { get; }
    BluetoothAddressType BluetoothAddressType { get; }
    DeviceInformation DeviceInformation { get; }
    public static IAsyncOperation<BluetoothLEDevice> FromBluetoothAddressAsync(ulong bluetoothAddress, BluetoothAddressType bluetoothAddressType);
    public static string GetDeviceSelectorFromAppearance(BluetoothLEAppearance appearance);
    public static string GetDeviceSelectorFromBluetoothAddress(ulong bluetoothAddress);
    public static string GetDeviceSelectorFromBluetoothAddress(ulong bluetoothAddress, BluetoothAddressType bluetoothAddressType);
    public static string GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus connectionStatus);
    public static string GetDeviceSelectorFromDeviceName(string deviceName);
    public static string GetDeviceSelectorFromPairingState(bool pairingState);
  }
}
namespace Windows.Devices.Bluetooth.Rfcomm {
  public sealed class RfcommServiceProvider {
    void StartAdvertising(StreamSocketListener listener, bool radioDiscoverable);
  }
}
namespace Windows.Devices.Enumeration {
  public sealed class DeviceInformationCustomPairing
  public sealed class DeviceInformationPairing {
    DeviceInformationCustomPairing Custom { get; }
    DevicePairingProtectionLevel ProtectionLevel { get; }
    IAsyncOperation<DevicePairingResult> PairAsync(DevicePairingProtectionLevel minProtectionLevel, IDevicePairingSettings devicePairingSettings);
    public static bool TryRegisterForAllInboundPairingRequests(DevicePairingKinds pairingKindsSupported);
    IAsyncOperation<DeviceUnpairingResult> UnpairAsync();
  }
  public enum DevicePairingKinds : uint
  public sealed class DevicePairingRequestedEventArgs
  public enum DevicePairingResultStatus {
    Failed = 19,
    OperationAlreadyInProgress = 15,
    PairingCanceled = 14,
    RejectedByHandler = 17,
    RemoteDeviceHasAssociation = 18,
    RequiredHandlerNotRegistered = 16,
  }
  public sealed class DeviceUnpairingResult
  public enum DeviceUnpairingResultStatus
  public interface IDevicePairingSettings
}
namespace Windows.Devices.Perception {
  public static class KnownPerceptionFrameSourceProperties {
    public static string DeviceId { get; }
  }
  public sealed class PerceptionColorFrameSource {
    string DeviceId { get; }
  }
  public sealed class PerceptionDepthFrameSource {
    string DeviceId { get; }
  }
  public sealed class PerceptionInfraredFrameSource {
    string DeviceId { get; }
  }
}
namespace Windows.Devices.Printers.Extensions {
  public sealed class Print3DWorkflow
  public enum Print3DWorkflowDetail
  public sealed class Print3DWorkflowPrintRequestedEventArgs
  public enum Print3DWorkflowStatus
}
namespace Windows.Devices.Sensors {
  public interface ISensorDataThreshold
  public sealed class Pedometer {
    IMapView<PedometerStepKind, PedometerReading> GetCurrentReadings();
    public static IVectorView<PedometerReading> GetReadingsFromTriggerDetails(SensorDataThresholdTriggerDetails triggerDetails);
  }
  public sealed class PedometerDataThreshold : ISensorDataThreshold
  public sealed class ProximitySensorDataThreshold : ISensorDataThreshold
  public sealed class SensorDataThresholdTriggerDetails
  public enum SensorType
}
namespace Windows.Devices.WiFiDirect {
  public sealed class WiFiDirectAdvertisement {
    IVector<WiFiDirectConfigurationMethod> SupportedConfigurationMethods { get; }
  }
  public enum WiFiDirectConfigurationMethod
  public sealed class WiFiDirectConnectionParameters : IDevicePairingSettings {
    IVector<WiFiDirectConfigurationMethod> PreferenceOrderedConfigurationMethods { get; }
    WiFiDirectPairingProcedure PreferredPairingProcedure { get; set; }
    public static DevicePairingKinds GetDevicePairingKinds(WiFiDirectConfigurationMethod configurationMethod);
  }
  public enum WiFiDirectPairingProcedure
}
namespace Windows.Gaming.UI {
  public static class GameBar
}
namespace Windows.Graphics.Display {
  public sealed class DisplayInformation {
    IReference<double> DiagonalSizeInInches { get; }
  }
}
namespace Windows.Graphics.Holographic {
  public struct HolographicAdapterId
  public sealed class HolographicCamera
  public sealed class HolographicCameraPose
  public sealed class HolographicCameraRenderingParameters
  public sealed class HolographicFrame
  public sealed class HolographicFramePrediction
  public enum HolographicFramePresentResult
  public enum HolographicFramePresentWaitBehavior
  public sealed class HolographicSpace
  public sealed class HolographicSpaceCameraAddedEventArgs
  public sealed class HolographicSpaceCameraRemovedEventArgs
  public struct HolographicStereoTransform
}
namespace Windows.Management.Orchestration {
  public sealed class CurrentAppOrchestration
  public sealed class SingleAppModeContext : IClosable
}
namespace Windows.Media.Capture {
  public sealed class AppCapture
}
namespace Windows.Media.Core {
  public sealed class MediaBinder
  public sealed class MediaBindingEventArgs
  public sealed class MediaSource : IClosable, IMediaPlaybackSource {
    MediaSourceState State { get; }
    event TypedEventHandler<MediaSource, MediaSourceStateChangedEventArgs> StateChanged;
    public static MediaSource CreateFromMediaBinder(MediaBinder binder);
    void Reset();
  }
  public enum MediaSourceState
  public sealed class MediaSourceStateChangedEventArgs
}
namespace Windows.Media.DialProtocol {
  public sealed class DialDevice {
    string FriendlyName { get; }
    IRandomAccessStreamReference Thumbnail { get; }
  }
}
namespace Windows.Media.Playback {
  public sealed class MediaPlaybackItem : IMediaPlaybackSource {
    public static MediaPlaybackItem FindFromMediaSource(MediaSource source);
  }
  public sealed class MediaPlaybackList : IMediaPlaybackSource {
    IReference<TimeSpan> MaxPrefetchTime { get; set; }
    IVectorView<MediaPlaybackItem> ShuffledItems { get; }
    MediaPlaybackItem StartingItem { get; set; }
    void SetShuffledItems(IIterable<MediaPlaybackItem> value);
  }
  public sealed class MediaPlayer {
    void AddAudioEffect(string activatableClassId, bool effectOptional, IPropertySet configuration);
    void RemoveAllEffects();
  }
}
namespace Windows.Media.Protection {
  public sealed class ProtectionCapabilities
  public enum ProtectionCapabilityResult
}
namespace Windows.Media.Streaming.Adaptive {
  public sealed class AdaptiveMediaSource : IMediaSource {
    AdaptiveMediaSourceAdvancedSettings AdvancedSettings { get; }
  }
  public sealed class AdaptiveMediaSourceAdvancedSettings
}
namespace Windows.Perception {
  public sealed class PerceptionTimestamp
  public static class PerceptionTimestampHelper
}
namespace Windows.Perception.People {
  public sealed class HeadPose
}
namespace Windows.Perception.Spatial {
  public sealed class SpatialAnchor
  public static class SpatialAnchorManager
  public sealed class SpatialAnchorRawCoordinateSystemAdjustedEventArgs
  public sealed class SpatialAnchorStore
  public struct SpatialBoundingBox
  public struct SpatialBoundingFrustum
  public struct SpatialBoundingOrientedBox
  public struct SpatialBoundingSphere
  public sealed class SpatialBoundingVolume
  public sealed class SpatialCoordinateSystem
  public enum SpatialLocatability
  public sealed class SpatialLocation
  public sealed class SpatialLocator
  public sealed class SpatialLocatorAttachedFrameOfReference
  public sealed class SpatialLocatorPositionalTrackingDeactivatingEventArgs
  public sealed class SpatialStationaryFrameOfReference
}
namespace Windows.Perception.Spatial.Surfaces {
  public sealed class SpatialSurface
  public sealed class SpatialSurfaceMesh
  public sealed class SpatialSurfaceMeshBuffer
  public sealed class SpatialSurfaceMeshIntersection
  public sealed class SpatialSurfaceMeshOptions
  public sealed class SpatialSurfaceObserver
}
namespace Windows.Security.Authentication.Web.Core {
  public sealed class WebTokenRequest {
    IMap<string, string> AppProperties { get; }
  }
}
namespace Windows.Security.Authentication.Web.Provider {
  public static class WebAccountManager {
    public static IAsyncAction PullCookiesAsync(string uriString, string callerPFN);
  }
}
namespace Windows.Security.Credentials {
  public sealed class KeyCredential {
    IBuffer RetrievePublicKey(CryptographicPublicKeyBlobType blobType);
  }
}
namespace Windows.Services.Maps {
  public static class MapService {
    public static string DataAttributions { get; }
  }
}
namespace Windows.Storage {
  public static class DownloadsFolder {
    public static IAsyncOperation<StorageFile> CreateFileForUserAsync(User user, string desiredName);
    public static IAsyncOperation<StorageFile> CreateFileForUserAsync(User user, string desiredName, CreationCollisionOption option);
    public static IAsyncOperation<StorageFolder> CreateFolderForUserAsync(User user, string desiredName);
    public static IAsyncOperation<StorageFolder> CreateFolderForUserAsync(User user, string desiredName, CreationCollisionOption option);
  }
  public enum KnownFolderId
  public static class KnownFolders {
    public static IAsyncOperation<StorageFolder> GetFolderForUserAsync(User user, KnownFolderId folderId);
  }
  public sealed class StorageLibrary {
    public static IAsyncOperation<StorageLibrary> GetLibraryForUserAsync(User user, KnownLibraryId libraryId);
  }
}
namespace Windows.System {
  public static class MemoryManager {
    public static bool TrySetAppMemoryUsageLimit(ulong value);
  }
}
namespace Windows.System.Profile {
  public enum PlatformDataCollectionLevel
  public static class PlatformDiagnosticsAndUsageDataSettings
}
namespace Windows.UI.Composition {
  public sealed class ColorKeyFrameAnimation : KeyFrameAnimation
  public enum CompositionAlphaMode
  public class CompositionAnimation : CompositionObject {
    void SetColorParameter(string key, Color value);
    void SetQuaternionParameter(string key, Quaternion value);
  }
  public enum CompositionBackfaceVisibility
  public sealed class CompositionBatch : CompositionObject
  public sealed class CompositionBatchCompletedEventArgs : CompositionObject
  public enum CompositionBatchTypes : uint
  public enum CompositionBitmapInterpolationMode
  public enum CompositionBorderMode
  public class CompositionBrush : CompositionObject
  public sealed class CompositionColorBrush : CompositionBrush
  public enum CompositionColorSpace
  public enum CompositionCompositeMode
  public sealed class CompositionDrawingSurface : CompositionObject, ICompositionSurface
  public sealed class CompositionEffectBrush : CompositionBrush
  public sealed class CompositionEffectFactory : CompositionObject {
    HResult ExtendedError { get; }
    CompositionEffectFactoryLoadStatus LoadStatus { get; }
    CompositionEffectBrush CreateBrush();
  }
  public sealed class CompositionEffectFactoryLoadResult
  public enum CompositionEffectFactoryLoadStatus {
    Other = -1, // used to be 2
    Pending = 2,
  }
  public sealed class CompositionGraphicsDevice {
    event TypedEventHandler<CompositionGraphicsDevice, RenderingDeviceReplacedEventArgs> RenderingDeviceReplaced;
    CompositionDrawingSurface CreateDrawingSurface(Size sizePixels, DirectXPixelFormat pixelFormat, CompositionAlphaMode alphaMode);
  }
  public class CompositionObject : IClosable {
    void ConnectAnimation(string propertyName, CompositionAnimation animation);
  }
  public sealed class CompositionPropertySet : CompositionObject {
    void InsertColor(string propertyName, Color value);
    void InsertQuaternion(string propertyName, Quaternion value);
    CompositionGetValueStatus TryGetColor(string propertyName, out Color value);
    CompositionGetValueStatus TryGetQuaternion(string propertyName, out Quaternion value);
  }
  public sealed class CompositionSurfaceBrush : CompositionBrush
  public sealed class Compositor : IClosable {

    CompositionColorBrush CreateColorBrush();
    CompositionColorBrush CreateColorBrush(Color color);
    ColorKeyFrameAnimation CreateColorKeyFrameAnimation();
    QuaternionKeyFrameAnimation CreateQuaternionKeyFrameAnimation();
    CompositionBatch CreateScopedBatch(CompositionBatchTypes batchType);
    SpriteVisual CreateSpriteVisual();
    CompositionSurfaceBrush CreateSurfaceBrush();
    CompositionSurfaceBrush CreateSurfaceBrush(ICompositionSurface surface);
    CompositionBatch GetCommitBatch(CompositionBatchTypes batchType);
  }
  public sealed class QuaternionKeyFrameAnimation : KeyFrameAnimation
  public sealed class RenderingDeviceReplacedEventArgs
  public sealed class SpriteVisual : ContainerVisual
  public class Visual : CompositionObject {
    Vector2 AnchorPoint { get; set; }
    CompositionBackfaceVisibility BackfaceVisibility { get; set; }
    CompositionBorderMode BorderMode { get; set; }
    CompositionCompositeMode CompositeMode { get; set; }
    bool IsVisible { get; set; }
  }
}

namespace Windows.UI.Core {
  public sealed class CoreWindow : ICorePointerRedirector, ICoreWindow {
    event TypedEventHandler<ICorePointerRedirector, PointerEventArgs> PointerRoutedAway;
    event TypedEventHandler<ICorePointerRedirector, PointerEventArgs> PointerRoutedReleased;
    event TypedEventHandler<ICorePointerRedirector, PointerEventArgs> PointerRoutedTo;
  }
  public interface ICorePointerRedirector
}
namespace Windows.UI.Input {
  public sealed class KeyboardDeliveryInterceptor
}
namespace Windows.UI.Input.Spatial {
  public sealed class SpatialGestureRecognizer
  public enum SpatialGestureSettings : uint
  public sealed class SpatialHoldCanceledEventArgs
  public sealed class SpatialHoldCompletedEventArgs
  public sealed class SpatialHoldStartedEventArgs
  public sealed class SpatialInputSource
  public sealed class SpatialInteraction
  public sealed class SpatialInteractionEventArgs
  public sealed class SpatialNavigationCanceledEventArgs
  public sealed class SpatialNavigationCompletedEventArgs
  public sealed class SpatialNavigationStartedEventArgs
  public sealed class SpatialNavigationUpdatedEventArgs
  public sealed class SpatialPathCanceledEventArgs
  public sealed class SpatialPathCompletedEventArgs
  public sealed class SpatialPathDelta
  public sealed class SpatialPathStartedEventArgs
  public sealed class SpatialPathUpdatedEventArgs
  public sealed class SpatialPointerDevice
  public enum SpatialPointerKind
  public sealed class SpatialPointerLocation
  public sealed class SpatialPointerPose
  public sealed class SpatialPointerProperties
  public sealed class SpatialPointerState
  public sealed class SpatialPointerStateEventArgs
  public sealed class SpatialRecognitionEndedEventArgs
  public sealed class SpatialRecognitionStartedEventArgs
  public sealed class SpatialTappedEventArgs
}
namespace Windows.UI.StartScreen {
  public sealed class JumpList
  public sealed class JumpListItem
  public enum JumpListItemKind
  public enum JumpListSystemGroupKind
}
namespace Windows.UI.Text.Core {
  public sealed class CoreTextEditContext {
    event TypedEventHandler<CoreTextEditContext, object> NotifyFocusLeaveCompleted;
  }
}
namespace Windows.UI.ViewManagement {
  public sealed class ApplicationViewTransferContext
}
namespace Windows.UI.WebUI {
  public sealed class WebUIDevicePairingActivatedEventArgs : IActivatedEventArgs, IActivatedEventArgsDeferral, IDevicePairingActivatedEventArgs
}
namespace Windows.UI.Xaml.Automation {
  public sealed class AutomationElementIdentifiers {
    public static AutomationProperty LandmarkTypeProperty { get; }
    public static AutomationProperty LocalizedLandmarkTypeProperty { get; }
  }
  public sealed class AutomationProperties {
    public static DependencyProperty LandmarkTypeProperty { get; }
    public static DependencyProperty LocalizedLandmarkTypeProperty { get; }
    public static AutomationLandmarkType GetLandmarkType(DependencyObject element);
    public static string GetLocalizedLandmarkType(DependencyObject element);
    public static void SetLandmarkType(DependencyObject element, AutomationLandmarkType value);
    public static void SetLocalizedLandmarkType(DependencyObject element, string value);
  }
}
namespace Windows.UI.Xaml.Automation.Peers {
  public enum AutomationLandmarkType
  public class AutomationPeer : DependencyObject {
    AutomationLandmarkType GetLandmarkType();
    virtual AutomationLandmarkType GetLandmarkTypeCore();
    string GetLocalizedLandmarkType();
    virtual string GetLocalizedLandmarkTypeCore();
  }
}
namespace Windows.UI.Xaml.Controls {
  public class MenuFlyoutPresenter : ItemsControl {
    MenuFlyoutPresenterTemplateSettings TemplateSettings { get; }
  }
  public class RichEditBox : Control {
    RichEditClipboardFormat ClipboardCopyFormat { get; set; }
    public static DependencyProperty ClipboardCopyFormatProperty { get; }
    IAsyncOperation<IVectorView<string>> GetLinguisticAlternativesAsync();
  }
  public enum RichEditClipboardFormat
  public class TextBox : Control {
    IAsyncOperation<IVectorView<string>> GetLinguisticAlternativesAsync();
  }
  public enum WebViewPermissionType {
    PointerLock = 3,
  }
}
namespace Windows.UI.Xaml.Controls.Maps {
  public sealed class MapActualCameraChangedEventArgs {
    MapCameraChangeReason ChangeReason { get; }
  }
  public sealed class MapActualCameraChangingEventArgs {
    MapCameraChangeReason ChangeReason { get; }
  }
  public enum MapCameraChangeReason
  public sealed class MapControl : Control {
    event TypedEventHandler<MapControl, MapRightTappedEventArgs> MapRightTapped;
  }
  public enum MapLoadingStatus {
    DataUnavailable = 2,
  }
  public sealed class MapPolygon : MapElement {
    IVector<Geopath> Paths { get; }
  }
  public sealed class MapRightTappedEventArgs
  public sealed class MapTargetCameraChangedEventArgs {
    MapCameraChangeReason ChangeReason { get; }
  }
}
namespace Windows.UI.Xaml.Controls.Primitives {
  public sealed class ComboBoxTemplateSettings : DependencyObject {
    double DropDownContentMinWidth { get; }
  }
  public sealed class CommandBarTemplateSettings : DependencyObject {
    double OverflowContentMaxWidth { get; }
  }
  public sealed class MenuFlyoutPresenterTemplateSettings : DependencyObject
}
namespace Windows.UI.Xaml.Hosting {
  public sealed class ElementCompositionPreview {
    public static Visual GetElementChildVisual(UIElement element);
    public static Visual GetElementVisual(UIElement element);
    public static CompositionPropertySet GetScrollViewerManipulationPropertySet(ScrollViewer scrollViewer);
    public static void SetElementChildVisual(UIElement element, Visual visual);
  }
}
namespace Windows.UI.Xaml.Media {
  public class FontFamily {
    public static FontFamily XamlAutoFontFamily { get; }
  }
  public sealed class PartialMediaFailureDetectedEventArgs {
    HResult ExtendedError { get; }
  }
}
namespace Windows.Web.Http.Filters {
  public sealed class HttpBaseProtocolFilter : IClosable, IHttpFilter {
    HttpCookieUsageBehavior CookieUsageBehavior { get; set; }
  }
  public enum HttpCookieUsageBehavior
}

 namespace Windows.Graphics.Printing3D {
  public sealed class Print3DManager
  public sealed class Print3DTask
  public sealed class Print3DTaskCompletedEventArgs
  public enum Print3DTaskCompletion
  public enum Print3DTaskDetail
  public sealed class Print3DTaskRequest
  public sealed class Print3DTaskRequestedEventArgs
  public sealed class Print3DTaskSourceChangedEventArgs
  public sealed class Print3DTaskSourceRequestedArgs
  public delegate void Print3DTaskSourceRequestedHandler(Print3DTaskSourceRequestedArgs args);
  public sealed class Printing3D3MFPackage
  public sealed class Printing3DBaseMaterial
  public sealed class Printing3DBaseMaterialGroup
  public struct Printing3DBufferDescription
  public enum Printing3DBufferFormat
  public sealed class Printing3DColorMaterial
  public sealed class Printing3DColorMaterialGroup
  public sealed class Printing3DComponent
  public sealed class Printing3DComponentWithMatrix
  public sealed class Printing3DCompositeMaterial
  public sealed class Printing3DCompositeMaterialGroup
  public struct Printing3DContract
  public sealed class Printing3DMaterial
  public sealed class Printing3DMesh
  public enum Printing3DMeshVerificationMode
  public sealed class Printing3DMeshVerificationResult
  public sealed class Printing3DModel
  public sealed class Printing3DModelTexture
  public enum Printing3DModelUnit
  public sealed class Printing3DMultiplePropertyMaterial
  public sealed class Printing3DMultiplePropertyMaterialGroup
  public enum Printing3DObjectType
  public sealed class Printing3DTexture2CoordMaterial
  public sealed class Printing3DTexture2CoordMaterialGroup
  public enum Printing3DTextureEdgeBehavior
  public sealed class Printing3DTextureResource
}

Changes in the Universal Windows Platform – Removed

namespace Windows.Foundation.Metadata {
  public sealed class PreviousContractVersionAttribute : Attribute {
    public PreviousContractVersionAttribute(Type contract, uint versionLow, uint versionHigh);
    public PreviousContractVersionAttribute(Type contract, uint versionLow, uint versionHigh, Type newContract);
  }
}

namespace Windows.Data.Json {
  public static class JsonError {
    public static JsonErrorStatus GetStatus(int hresult);
  }
}

namespace Windows.Management.Orchestration {
  public sealed class CurrentAppOrchestration
  public sealed class SingleAppModeContext : IClosable
}

namespace Windows.UI.Composition {
  public sealed class AnimationEndedEventArgs : CompositionObject
  public enum AnimationEndReason
  public sealed class CompositionEffect : CompositionObject
  public sealed class CompositionEffectFactory : CompositionObject {
    IAsyncOperation<CompositionEffectFactoryLoadResult> CompleteLoadAsync();
    CompositionEffect CreateEffect();
  }
  public sealed class CompositionEffectFactoryLoadResult
  public enum CompositionEffectFactoryLoadStatus {
    Other = 2, // now -1
  }
  public sealed class CompositionGraphicsDevice {
    CompositionImage CreateImageFromUri(Uri uri);
    CompositionImage CreateImageFromUri(Uri uri, CompositionImageOptions options);
  }
  public sealed class CompositionImage : CompositionObject, ICompositionSurface
  public sealed class CompositionImageLoadResult
  public enum CompositionImageLoadStatus
  public sealed class CompositionImageOptions
  public enum CompositionImageProgressStage
  public class CompositionObject : IClosable {
    CompositionPropertyAnimator ConnectAnimation(string propertyName, CompositionAnimation animation);
  }
  public sealed class CompositionPropertyAnimator : CompositionObject
  public sealed class Compositor : IClosable {
    CompositionGraphicsDevice DefaultGraphicsDevice { get; }
    EffectVisual CreateEffectVisual();
    ImageVisual CreateImageVisual();
    SolidColorVisual CreateSolidColorVisual();
  }
  public sealed class EffectVisual : ContainerVisual
  public sealed class ImageVisual : ContainerVisual
  public sealed class SolidColorVisual : ContainerVisual
}

Changes in the Windows Desktop Extension – Added

namespace Windows.Media.Capture {
  public sealed class AppCaptureAlternateShortcutKeys {
    VirtualKey ToggleMicrophoneCaptureKey { get; set; }
    VirtualKeyModifiers ToggleMicrophoneCaptureKeyModifiers { get; set; }
  }
  public sealed class AppCaptureSettings {
    bool IsMicrophoneCaptureEnabled { get; set; }
  }
}

 
namespace Windows.Security.EnterpriseData {
  public enum DataProtectionStatus {
    AccessSuspended = 5,
    LicenseExpired = 4,
  }
  public enum EnforcementLevel
  public static class FileProtectionManager {
    public static IAsyncOperation<bool> IsContainerAsync(IStorageFile file);
    public static IAsyncOperation<ProtectedContainerImportResult> LoadFileFromContainerAsync(IStorageFile containerFile, IStorageItem target, NameCollisionOption collisionOption);
    public static IAsyncOperation<ProtectedContainerExportResult> SaveFileAsContainerAsync(IStorageFile protectedFile, IIterable<string> sharedWithIdentities);
  }
  public enum FileProtectionStatus {
    AccessSuspended = 9,
    LicenseExpired = 8,
  }
  public enum ProtectedImportExportStatus {
    AccessSuspended = 7,
    LicenseExpired = 6,
  }
  public sealed class ProtectionPolicyManager {
    public static bool IsProtectionEnabled { get; }
    public static event EventHandler<object> PolicyChanged;
    public static ProtectionPolicyEvaluationResult CheckAccessForApp(string sourceIdentity, string appPackageFamilyName);
    public static EnforcementLevel GetEnforcementLevel(string identity);
    public static bool HasContentBeenRevokedSince(string identity, DateTime since);
    public static bool IsProtectionUnderLockRequired(string identity);
    public static bool IsUserDecryptionAllowed(string identity);
    public static IAsyncOperation<ProtectionPolicyEvaluationResult> RequestAccessForAppAsync(string sourceIdentity, string appPackageFamilyName);
  }
}

 namespace Windows.Services.Maps.Guidance {
  public enum GuidanceAudioNotificationKind
  public sealed class GuidanceAudioNotificationRequestedEventArgs
  public sealed class GuidanceNavigator {
    bool IsGuidanceAudioMuted { get; set; }
    public static bool UseAppProvidedVoice { get; }
    event TypedEventHandler<GuidanceNavigator, GuidanceAudioNotificationRequestedEventArgs> AudioNotificationRequested;
  }
}

 namespace Windows.UI.Xaml.Controls.Maps {
  public sealed class MapControlBusinessLandmarkClickEventArgs
  public sealed class MapControlBusinessLandmarkRightTappedEventArgs
  public sealed class MapControlDataHelper : DependencyObject
  public sealed class MapControlTransitFeatureClickEventArgs
  public sealed class MapControlTransitFeatureRightTappedEventArgs
}

Changes in the Windows Desktop Extension – Removed

namespace Windows.Devices.Printers.Extensions {
  public sealed class Print3DWorkflow
  public enum Print3DWorkflowDetail
  public sealed class Print3DWorkflowPrintRequestedEventArgs
  public enum Print3DWorkflowStatus
}

namespace Windows.Devices.Printers {
  public sealed class Print3DDevice
  public struct PrintersContract
  public sealed class PrintSchema
}

namespace Windows.Graphics.Printing3D {
  public sealed class Print3DManager
  public sealed class Print3DTask
  public sealed class Print3DTaskCompletedEventArgs
  public enum Print3DTaskCompletion
  public enum Print3DTaskDetail
  public sealed class Print3DTaskRequest
  public sealed class Print3DTaskRequestedEventArgs
  public sealed class Print3DTaskSourceChangedEventArgs
  public sealed class Print3DTaskSourceRequestedArgs
  public delegate void Print3DTaskSourceRequestedHandler(Print3DTaskSourceRequestedArgs args);
  public sealed class Printing3D3MFPackage
  public sealed class Printing3DBaseMaterial
  public sealed class Printing3DBaseMaterialGroup
  public struct Printing3DBufferDescription
  public enum Printing3DBufferFormat
  public sealed class Printing3DColorMaterial
  public sealed class Printing3DColorMaterialGroup
  public sealed class Printing3DComponent
  public sealed class Printing3DComponentWithMatrix
  public sealed class Printing3DCompositeMaterial
  public sealed class Printing3DCompositeMaterialGroup
  public struct Printing3DContract
  public sealed class Printing3DMaterial
  public sealed class Printing3DMesh
  public enum Printing3DMeshVerificationMode
  public sealed class Printing3DMeshVerificationResult
  public sealed class Printing3DModel
  public sealed class Printing3DModelTexture
  public enum Printing3DModelUnit
  public sealed class Printing3DMultiplePropertyMaterial
  public sealed class Printing3DMultiplePropertyMaterialGroup
  public enum Printing3DObjectType
  public sealed class Printing3DTexture2CoordMaterial
  public sealed class Printing3DTexture2CoordMaterialGroup
  public enum Printing3DTextureEdgeBehavior
  public sealed class Printing3DTextureResource
}

Changes in the Windows Mobile Extension – Added

namespace Windows.ApplicationModel.Calls.Provider {
  public sealed class PhoneCallOrigin {
    string DisplayName { get; set; }
  }
}

Changes in the Windows IOT Extension – Added

namespace Windows.Devices {
  public interface ILowLevelDevicesAggregateProvider
  public sealed class LowLevelDevicesAggregateProvider : ILowLevelDevicesAggregateProvider
  public sealed class LowLevelDevicesController
}
namespace Windows.Devices.Adc {
  public sealed class AdcController {
    public static IAsyncOperation<AdcController> GetDefaultAsync();
  }
}
namespace Windows.Devices.Gpio {
  public sealed class GpioController {
    public static IAsyncOperation<IVectorView<GpioController>> GetControllersAsync(IGpioProvider provider);
    public static IAsyncOperation<GpioController> GetDefaultAsync();
  }
}
namespace Windows.Devices.Gpio.Provider {
  public sealed class GpioPinProviderValueChangedEventArgs
  public interface IGpioControllerProvider
  public interface IGpioPinProvider
  public interface IGpioProvider
  public enum ProviderGpioPinDriveMode
  public enum ProviderGpioPinEdge
  public enum ProviderGpioPinValue
  public enum ProviderGpioSharingMode
}
namespace Windows.Devices.I2c {
  public sealed class I2cController
}
namespace Windows.Devices.I2c.Provider {
  public interface II2cControllerProvider
  public interface II2cDeviceProvider : IClosable
  public interface II2cProvider
  public enum ProviderI2cBusSpeed
  public sealed class ProviderI2cConnectionSettings
  public enum ProviderI2cSharingMode
  public struct ProviderI2cTransferResult
  public enum ProviderI2cTransferStatus
}
namespace Windows.Devices.Pwm {
  public sealed class PwmController {
    public static IAsyncOperation<PwmController> GetDefaultAsync();
  }
}
namespace Windows.Devices.Spi {
  public sealed class SpiController
}
namespace Windows.Devices.Spi.Provider {
  public interface ISpiControllerProvider
  public interface ISpiDeviceProvider : IClosable
  public interface ISpiProvider
  public sealed class ProviderSpiConnectionSettings
  public enum ProviderSpiMode
  public enum ProviderSpiSharingMode
}

namespace Windows.System {
  public static class ProcessLauncher
  public sealed class ProcessLauncherOptions
  public sealed class ProcessLauncherResult
}

Moving your projects forward

After installing the new Windows 10 SDK, update your projects with the Visual Studio Release Candidate to use the new SDK.

First, update the Project file (.csproj, .jsproj, .vcxproj) by:

  1. Opening the project in Visual Studio
  2. Right clicking on the project in the Visual Studio Solution Explorer, and choose “Properties”
  3. Depending on your project type, the UI will look a little different but click on the dropdown that says “Target Version”. The below screenshot is from a C# Project. Note: If you’re using a Javascript project, open the .jsproj and find a replace the TargetPlatformVersion with 10.0. 10563.0.
  4. Select Windows 10 Insider Preview (10.0; Build 10563).

Now that you have updated the project file, find the application’s Package.appxmanifest and do the following:

  1. Open that file (it should present you with an XML Editor)
  2. Find the Element, Dependencies and its child element, TargetDeviceFamily
  3. Modify the MaxVersion Tested Attribute from “10.0.10240.0” to “10.0.10563.0.”
  4. Save and close the file.

Known Issues

SDK Backwards compatibility: Do not install this preview SDK on your production machine. If you do so, any applications you submit to the Store after installing this SDK will fail validation because this SDK will update some of the build tools used to preview versions of those tools.

If you have other issues, please post to the forums and include the following [UWP][SDK] in the title if it is a Windows 10 SDK install or uninstall issue.

Now you’re ready to use the new SDK. Start developing and @WindowsDev would love to see what you create. If you find bugs or issues, please leverage the Windows Feedback tool or MSDN forums.

Create more secure apps with less effort (10 by 10)

$
0
0

In our final post of the Windows 10 by 10 development series, we’ll talk about the feature introductions and enhancements in Windows 10 that help you create more secure apps. When we think of security, we can split it up in these three main areas: authentication, data-in-flight and data-at-rest. With Windows 10, a number of improvements have been made to lessen the effort for developers in the authentication and data-at-rest areas, specifically around protecting sensitive data on the device and moving away from using passwords. Additionally, Azure API Management can help simplify exposing app APIs securely.

From passwords to Microsoft Passport

Dealing with user credentials for authentication and authorization is something that users and administrators have been doing for quite some time. The problems with traditional user credentials: credential theft, reuse, password complexity and reset mechanisms can make creating secure apps more complex. With Windows 10, Microsoft addresses these problems with two new technologies: Windows Hello and Microsoft Passport. Working together, these technologies help create a more secure, yet convenient way to manage authentication for both end-users and developers.

Windows Hello is the biometric framework built into Windows 10. The three types of biometrics currently supported with Windows Hello are: facial recognition, fingerprint recognition and iris scan. Microsoft Passport is the component that provides strong two-factor authentication, replacing reusable passwords with the combination of a specific device and a user defined PIN or the biometric modalities of Hello. This combination can be used to authenticate users directly with Windows and apps can use the Universal Windows Platform (UWP) APIs offered to implement this authentication. For more information on Windows Hello and Microsoft Passport, check out the extensive Microsoft Passport guide on TechNet, but for now let’s dig into the APIs to use in your UWP apps.

The first thing to do is check whether or not the user is set up for Microsoft Passport in Windows. This can be done with the KeyCredentialManager.IsSupportedAsync method:

var keyCredentialAvailable = await KeyCredentialManager.IsSupportedAsync ();

if (keyCredentialAvailable != true)
{
   // Key credential is not enabled yet as user, prompt user to
   // set up a PIN by visiting Settings->Accounts->Sign-in options->Pin->Add
   return;
}

The next step is to call the KeyCredentialManager.RequestCreateAsync method to generate a private and public key pair. This generation is performed by the Trusted Platform Module (TPM) chip on the device, or by Windows when there’s no TPM-chip available on the device:

var keyCreationResult = await KeyCredentialManager.RequestCreateAsync(AccountId, KeyCredentialCreationOption.ReplaceExisting);

The private keys are opaque to the caller, but the public key should be stored on your identity provider server, together with the user’s unique identifier (e-mail address, username, etc.).

With subsequent uses of the app, the KeyCredentialManager.OpenAsync method is used to prompt the user to authenticate with Microsoft Passport and get the KeyCredential on successful authentication. In the case below the server sends a challenge the client needs to sign with the private key.

var openKeyResult = await KeyCredentialManager.OpenAsync(AccountId);

if (openKeyResult.Status == KeyCredentialStatus.Success)
{
  var userCredential = openKeyResult.KeyCredential;
  var publicKey = userCredential.RetrievePublicKey();
  var signResult = await userCredential.RequestSignAsync(message);
  
  if (signResult.Status == KeyCredentialStatus.Success)
  {
    return signResult.Result;
  }
}	

As you can see above, after we get the KeyCredential, we use that to sign a message with the RequestSignAsync method. The message is signed with the private key and sent back to server. The server can check if the message is signed by validating the signature with the stored public key of the user:

1_diagram

This high-level overview of Windows Hello and Microsoft Passport should give you an idea of how this can be implemented in your app. We’ll have a full sample and developer whitepaper to share soon, taking you through the end-to-end approach for implementation in new apps or moving an existing solution from using passwords to Microsoft Passport.

Connecting securely to your web services

Connecting with your back end in a secure way is important for making sure that data does not get intercepted while in flight. The basic requirement of using Secure Sockets Layer (SSL) to establish and maintain secure connections to servers supporting the Secure Hypertext Transfer (HTTPS) protocol is essential in ensuring this message confidentiality. Simply relying on SSL, however, still leaves the possibility for malicious third parties to sit between the client and server, for example by offering insecure “free Wi-Fi” to users and intercepting all traffic. To prevent this, you can validate the SSL certificates that are used by the server by using a technique commonly referred to as “SSL pinning”.

There are a few different ways to implement SSL pinning, each with their own pros and cons. The easiest way to implement it is via the Certificates declaration in the app’s manifest. This declaration enables the app package to install digital certificates and specify exclusive trust to them. This means SSL connections are only allowed from the app to servers with the corresponding root certificate on the server.

2_appxManifest

For some more flexibility (when communicating with various web servers over SSL, for example), validating the thumbprint(s) of the certificate(s) the server returns when sending an HTTP request might be a better option. One thing to be aware of is that this method requires sending a request and inspecting the response, so be sure to add this as a validation before actually sending sensitive information in a request. The C# code will look similar to this:

private async Task DemoSSLRoot()
{
    // Send a get request to Bing
    HttpClient client = new HttpClient();
    Uri bingUri = new Uri("https://www.bing.com");
    HttpResponseMessage response = await client.GetAsync(bingUri);

    // Get the list of certificates that were used to validate the server's identity
    IReadOnlyList<Certificate> serverCertificates = response.RequestMessage.TransportInformation.ServerIntermediateCertificates;
    
    // Perform validation
    if (!ValidCertificates(serverCertificates))
    {
        // Close connection as chain is not valid
        return;
    }

    PrintResults("Validation passed\n");
    // Validation passed, continue with connection to service
}

private bool ValidCertificates(IReadOnlyList<Certificate> certs)
{
    // In this example, we iterate through the certificates and check that the chain contains
    // one specific certificate we are expecting
    for(int i=0; i<certs.Count; i++)
    {
        PrintResults("Cert# " + i + ": " + certs[i].Subject + "\n");
        byte[] thumbprint = certs[i].GetHashValue();

        // Check if the thumbprint matches whatever you are expecting
        // ‎d4 de 20 d0 5e 66 fc 53 fe 1a 50 88 2c 78 db 28 52 ca e4 74
        byte[] expected = new byte[] { 212, 222, 32, 208, 94, 102, 252, 83, 254, 26, 80, 136, 44, 120, 219, 40, 82, 202, 228, 116 };

        if (ThumbprintMatches(thumbprint, expected))
        {
            return true;
        }
    }

    return false;
}

In the above example, the DemoSSLRoot method uses the HttpClient class to execute an HTTP request. When the response is given by the client, the RequestMessage.TransportInformation.ServerIntermediateCertificates collection can be used to inspect the certificates returned by the server. This way, the client can validate the entire certificate chain with the thumbprints it has prepopulated. Be aware that this requires the thumbprints of all certificates to be updated in the app, once the server certificate expires and is renewed.

Providing secure access to your back end web APIs can prevent unauthorized use of your APIs. With the growing popularity of RESTful services, however, this becomes increasingly difficult, as data should be accessible through basic HTTP GET/POST requests. The use of API keys for securing RESTful services is a common practice and, while you can implement this yourself, Azure API Management provides a way to publish an API securely, while also being able to monitor, throttle and analyze it.

Securing data on the device

A third place where you need to pay attention to app security is when the data arrives on the device. Storing data securely on the device is something Windows and its app model already helps you with. By default, UWP apps are isolated in their own container, so their data won’t be accessible by other UWP apps. This benefits both reliability and security, as there is no risk of any UWP apps locking, accessing or modifying data, other than the app itself.

While securing data on the device by ways of encryption is usually a good practice, for example with BitLocker, it doesn’t prevent data from being shared to unauthorized third parties by users. That’s why Windows 10 introduces a new capability for enterprises that prevent data leaks by encrypting and classifying data as business data, so it can no longer be accidentally shared outside of a company. This not only protects data at rest on the device, but also data in flight and in use. To implement this capability in your internal apps, you first need to enable the enterpriseDataPolicy capability in your app’s manifest:

<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:rescap= "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"  
  IgnorableNamespaces="uap mp rescap"> 
  <Capabilities>  
    <rescap:Capability Name="enterpriseDataPolicy"/>  
  </Capabilities> 
</Package>

Be aware that this is a restricted capability, which means your app will not be eligible for Windows Store publication unless your organization has been specifically approved for it. This does not prevent you from using the capability internally within an organization or when sideloading.

This enables a number of data protection scenarios, including file protection, and application sharing restrictions, that lets work and personal data be used safely in the same application. For example, if you want to show the user some non-corporate data while the application places some enterprise-owned text on the clipboard, and restrict that text to be pasted only in corporate apps that are also allowed access to enterprise data, you’d use the following code:

var dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage();
dataPackage.SetText(MyTextBox.Text);
dataPackage.Properties.EnterpriseId = yourEnterpriseID;

Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);

In the above example, we create a DataPackage instance, which contains an EnterpriseId property. We can then use the ProtectionPolicyManager to verify if the app is allowed to access the content it’s trying to retrieve from the Clipboard using the Clipboard.GetContent method:

var dataPackageView = Clipboard.GetContent();
if (dataPackageView.Contains(StandardDataFormats.Text))
{
    var response = await dataPackageView.RequestAccessAsync();
    if (response == ProtectionPolicyEvaluationResult.Allowed)
    {
      // Allowed access to clipboard
    }
    else
    {
      // Blocked access to clipboard
    }
}

For more scenarios, take a look at the Enterprise Data Protection sample on GitHub.

Wrapping up

While security remains a complex topic, we’re hoping the description of these new features in Windows 10 give you some ideas on how to harden your UWP apps without having to write large amounts of code. Relying on these Windows 10 features will allow you to focus on the things your app does best, without having to compromise on security.

That brings us to the end of our Windows 10 by 10 development series. We thank you for diving into the 10 compelling Windows platform capabilities over the last 10 weeks and hope the information has inspired you to create great new apps.

The “Know Your Options When it Comes to Storage, Backup and Roaming” quiz is now available on DVLUP to get points and XP for getting up to speed on this week’s topic. Let us know what you think about the series and this week’s topic via @WindowsDev on Twitter using #Win10x10.

Resources

New Windows 10 application usage in Dev Center

$
0
0

Recently, we released a new feature that provides app usage information to developers in Dev Center.

This feature is included in all new Windows 10 (UWP) package submissions and allows developers to view app usage statistics, including user sessions, active users, session length, page views, and custom events created specifically for an app (for example how many times users reach a certain level in the game). App developers are provided aggregated statistics only, and not any information about individual users or devices.
How to enable application usage

  1. Build a UWP package in Visual Studio 2015.
  2. Select “Show telemetry in the Windows Dev Center” checkbox (which adds the Visual Studio Application Insights SDK to your project).
    • All Windows 10 app submissions will include the telemetry SDK. If you don’t want to use this feature, please uncheck this box to disable app usage information
  3. Select “Enable richer analytics with Application Insights” if you have an Azure subscription and want to see the data and do deeper analysis in the Azure portal
    1_newProject
  4. Submit the packages to the Store. Data will show up after users download the updated package and start using the app.
  5. View the report in the “Analytics/Usage” page in Dev Center. The report will show:
    • An Instrumentation Key has been created for the app
    • App usage telemetry for the app, if enabled
      2_devCenter

You can read more information in the documentation.

Viewing all 623 articles
Browse latest View live