Skip to content

Commit

Permalink
Merge pull request MicrosoftDocs#16326 from v-stgreg/includes
Browse files Browse the repository at this point in the history
Includes
  • Loading branch information
GitHubber17 authored Aug 1, 2017
2 parents 2ba456f + 5b1a848 commit 6440869
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,30 @@ Completing this tutorial is a prerequisite for all other Notification Hubs tutor
To send push notifications to UWP apps, you must associate your app to the Windows Store. You must then configure your notification hub to integrate with WNS.

1. If you have not already registered your app, navigate to the [Windows Dev Center](https://dev.windows.com/overview), sign in with your Microsoft account, and then click **Create a new app**.
2. Type a name for your app and click **Reserve app name**.

![](./media/notification-hubs-windows-store-dotnet-get-started/notification-hubs-win8-app-name.png)

This creates a new Windows Store registration for your app.
3. In Visual Studio, create a new Visual C# Store Apps project by using the **Blank App** template and click **OK**.

![](./media/notification-hubs-windows-store-dotnet-get-started/notification-hub-create-windows-universal-app.png)

2. Type a name for your app and click **Reserve app name**. This creates a new Windows Store registration for your app.

3. In Visual Studio, create a new Visual C# Store Apps project by using the Windows Universal **Blank App** template and click **OK**.

4. Accept the defaults for the target and minimum platform versions.
5. In Solution Explorer, right-click the Windows Store app project, click **Store**, and then click **Associate App with the Store...**.

![](./media/notification-hubs-windows-store-dotnet-get-started/notification-hub-associate-win8-app.png)

The **Associate Your App with the Windows Store** wizard appears.
5. In Solution Explorer, right-click the Windows Store app project, click **Store**, and then click **Associate App with the Store...**. The **Associate Your App with the Windows Store** wizard appears.

1. In the wizard, click **Sign in** and then sign in with your Microsoft account.
2. Click the app that you registered in step 2, click **Next**, and then click **Associate**.

![](./media/notification-hubs-windows-store-dotnet-get-started/notification-hub-associate-app-name.png)

This adds the required Windows Store registration information to the application manifest.
3. Back on the [Windows Dev Center](http://go.microsoft.com/fwlink/p/?LinkID=266582) page for your new app, click **Services**, click **Push notifications**, and then click **Live Services site** under **Windows Push Notification Services (WNS) and Microsoft Azure Mobile Apps**.

![](./media/notification-hubs-windows-store-dotnet-get-started/notification-hubs-uwp-app-live-services.png)
4. On the registration page for your app, make a note of the **Application Secret** password and the **Package security identifier (SID)** located in the **Windows Store** platform settings.

![](./media/notification-hubs-windows-store-dotnet-get-started/notification-hubs-uwp-app-push-auth.png)
6. In the wizard, sign in with your Microsoft account.

7. Click the app that you registered in step 2, click **Next**, and then click **Associate**. This adds the required Windows Store registration information to the application manifest.

8. Back on the [Windows Dev Center](http://dev.windows.com/overview) page for your new app, click **Services**, click **Push notifications**, and then click **WNS/MPNS**.

9. Click **New Notification**.

10. Click **Blank (Toast)** template and then click **OK**.

11. Enter a notification **Name** and Visual **Context** message. Then click **Save as draft**.

12. Navigate to the [Application Registration Portal](http://apps.dev.microsoft.com) and log in.

13. Click on your application name. Make a note of the **Application Secret** password and the **Package security identifier (SID)** located in the **Windows Store** platform settings.

> [AZURE.WARNING]
The application secret and package SID are important security credentials. Do not share these values with anyone or distribute them with your app.
Expand Down Expand Up @@ -132,8 +129,6 @@ Your notification hub is now configured to work with WNS, and you have the conne

This guarantees that the channel URI is registered in your notification hub each time the application is launched.
6. Press the **F5** key to run the app. A pop-up dialog that contains the registration key is displayed.

![][19]

Your app is now ready to receive toast notifications.

Expand All @@ -157,9 +152,8 @@ To send notifications by using a .NET console application follow these steps.

1. Right-click the solution, select **Add** and **New Project...**, and then under **Visual C#**, click **Windows** and **Console Application**, and click **OK**.

![][13]

This adds a new Visual C# console application to the solution. You can also do this in a separate solution.

2. In Visual Studio, click **Tools**, click **NuGet Package Manager**, and then click **Package Manager Console**.

This displays the Package Manager Console in Visual Studio.
Expand Down Expand Up @@ -195,8 +189,6 @@ To send notifications by using a .NET console application follow these steps.
Console.ReadLine();
7. Right-click the console application project in Visual Studio, and click **Set as StartUp Project** to set it as the startup project. Then press the **F5** key to run the application.

![][14]

You will receive a toast notification on all registered devices. Clicking or tapping the toast banner loads the app.

You can find all the supported payloads in the [toast catalog], [tile catalog], and [badge overview] topics on MSDN.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 1 addition & 7 deletions includes/mobile-engagement-windows-store-prereqs.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@

This tutorial requires the following:

* Visual Studio 2015
* Visual Studio 2015 or 2017
* [MicrosoftAzure.MobileEngagement](http://go.microsoft.com/?linkid=9864592) Nuget package

> [!IMPORTANT]
> This tutorial assumes use of Visual Studio 15. You can also use Visual Studio 13, but that user interface is slightly different from what is in this tutorial.
>
>
 

> [!NOTE]
> To complete this tutorial, you must have an active Azure account. If you don't have an account, you can create a free trial account in just a couple of minutes. For details, see [Azure Free Trial](https://azure.microsoft.com/pricing/free-trial/?WT.mc_id=A0E0E5C02&returnurl=http%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fdocumentation%2Farticles%2Fmobile-engagement-windows-store-dotnet-get-started).
Expand Down
26 changes: 14 additions & 12 deletions includes/notification-hubs-aspnet-backend-notifyusers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A new ASP.NET WebAPI backend will be created in the sections that follow and it
The following steps show how to create the new ASP.NET WebAPI backend:

> [!NOTE]
> **Important**: Before starting this tutorial, please ensure that you have installed the latest version of the NuGet Package Manager. To check, start Visual Studio. From the **Tools** menu, click **Extensions and Updates**. Search for **NuGet Package Manager for Visual Studio 2013**, and make sure you have version 2.8.50313.46 or later. If not, please uninstall, then reinstall the NuGet Package Manager.
> **Important**: If you are using Visual Studio 2015 or earlier, before starting this tutorial, please ensure that you have installed the latest version of the NuGet Package Manager. To check, start Visual Studio. From the **Tools** menu, click **Extensions and Updates**. Search for **NuGet Package Manager** for your version of Visual Studio, and make sure you have the latest version. If not, please uninstall, then reinstall the NuGet Package Manager.
>
> ![][B4]
>
Expand Down Expand Up @@ -38,7 +38,9 @@ In this section, you will create a new message handler class named **Authenticat
using System.Threading;
using System.Security.Principal;
using System.Net;
using System.Web;
using System.Text;
using System.Threading.Tasks;

3. In AuthenticationTestHandler.cs, replacing the `AuthenticationTestHandler` class definition with the following code.

This handler will authorize the request when the following three conditions are all true:
Expand All @@ -53,7 +55,6 @@ In this section, you will create a new message handler class named **Authenticat

public class AuthenticationTestHandler : DelegatingHandler
{

protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -314,15 +315,16 @@ In this section you add a new controller that exposes a way for client devices t

## Publish the new WebAPI Backend
1. Now we will deploy this app to an Azure Website in order to make it accessible from all devices. Right-click on the **AppBackend** project and select **Publish**.
2. Select **Microsoft Azure Web Apps** as your publish target.
2. Select **Microsoft Azure App Service** as your publish target and click **Publish**. This opens the Create App Service dialog, which helps you create all the necessary Azure resources to run the ASP.NET web app in Azure.

![][B15]
3. Log in with your Azure account and select an existing or new Web App.

![][B16]
4. Make a note of the **destination URL** property in the **Connection** tab. We will refer to this URL as your *backend endpoint* later in this tutorial. Click **Publish**.

![][B18]
3. In the **Create App Service** dialog, select your Azure account. Click **Change Type** and select **Web App**. Keep the **Web App Name** given and select the **Subscription**, **Resource Group**, and **App Service Plan**. Click **Create**.

4. Make a note of the **Site URL** property in the **Summary** section. We will refer to this URL as your *backend endpoint* later in this tutorial. Click **Publish**.

5. Once the wizard completes, it publishes the ASP.NET web app to Azure, and then launches the app in the default browser. Your application will be viewable in Azure App Services.

The URL uses the web app name that you specified earlier, with the format http://<app_name>.azurewebsites.net.

[B1]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-secure-push1.png
[B2]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-secure-push2.png
Expand All @@ -333,6 +335,6 @@ In this section you add a new controller that exposes a way for client devices t
[B7]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-secure-push7.png
[B8]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-secure-push8.png
[B14]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-secure-push14.png
[B15]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-notify-users15.PNG
[B15]: ./media/notification-hubs-aspnet-backend-notifyusers/publish-to-app-service.png
[B16]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-notify-users16.PNG
[B18]: ./media/notification-hubs-aspnet-backend-notifyusers/notification-hubs-notify-users18.PNG

0 comments on commit 6440869

Please sign in to comment.