向 Xamarin Forms 应用添加身份验证Add authentication to your Xamarin Forms app

Note

Visual Studio App Center 正在投资于对移动应用开发至关重要的新集成服务。Visual Studio App Center is investing in new and integrated services central to mobile app development. 开发人员可以使用生成测试分发服务来设置持续集成和交付管道。Developers can use Build, Test and Distribute services to set up Continuous Integration and Delivery pipeline. 部署应用后,开发人员可以使用分析诊断服务监视其应用的状态和使用情况,并使用推送服务与用户互动。Once the app is deployed, developers can monitor the status and usage of their app using the Analytics and Diagnostics services, and engage with users using the Push service. 开发人员还可以利用 Auth 对用户进行身份验证,利用数据服务在云中持久保存和同步应用数据。Developers can also leverage Auth to authenticate their users and Data service to persist and sync app data in the cloud. 立即查看 App CenterCheck out App Center today.

概述Overview

本主题演示如何从客户端应用程序对应用服务移动应用的用户进行身份验证。This topic shows you how to authenticate users of an App Service Mobile App from your client application. 在本教程中,使用应用服务支持的标识提供者向 Xamarin Forms 快速入门项目添加身份验证。In this tutorial, you add authentication to the Xamarin Forms quickstart project using an identity provider that is supported by App Service. 移动应用成功进行身份验证和授权后,将显示用户 ID 值,该用户能够访问受限制的表数据。After being successfully authenticated and authorized by your Mobile App, the user ID value is displayed, and you will be able to access restricted table data.

先决条件Prerequisites

为了使本教程达到最佳效果,建议你先完成创建 Xamarin Forms 应用教程。For the best result with this tutorial, we recommend that you first complete the Create a Xamarin Forms app tutorial. 完成此教程后,用户可以获得一个 Xamarin Forms 项目,它是一个多平台 TodoList 应用。After you complete this tutorial, you will have a Xamarin Forms project that is a multi-platform TodoList app.

如果不使用下载的快速入门服务器项目,必须将身份验证扩展包添加到项目。If you do not use the downloaded quick start server project, you must add the authentication extension package to your project. 有关服务器扩展包的详细信息,请参阅使用适用于 Azure 移动应用的 .NET 后端服务器 SDKFor more information about server extension packages, see Work with the .NET backend server SDK for Azure Mobile Apps.

注册应用以进行身份验证并配置应用服务Register your app for authentication and configure App Services

首先,需要在标识提供者站点上注册应用,然后在移动应用后端设置提供者生成的凭据。First, you need to register your app at an identity provider's site, and then you will set the provider-generated credentials in the Mobile Apps back end.

  1. 请按照以下提供者特定的说明来配置首选标识提供者:Configure your preferred identity provider by following the provider-specific instructions:

  2. 为要在应用中支持的各提供者重复上述步骤。Repeat the previous steps for each provider you want to support in your app.

将应用添加到允许的外部重定向 URLAdd your app to the Allowed External Redirect URLs

安全身份验证要求为应用定义新的 URL 方案。Secure authentication requires that you define a new URL scheme for your app. 此方案允许在完成身份验证过程后,身份验证系统重定向到应用。This allows the authentication system to redirect back to your app once the authentication process is complete. 在本教程中,我们自始至终使用 URL 方案 appnameIn this tutorial, we use the URL scheme appname throughout. 但是,可以使用任何你所选的 URL 方案。However, you can use any URL scheme you choose. 对于移动应用程序而言,它应是唯一的。It should be unique to your mobile application. 在服务器端启用重定向:To enable the redirection on the server side:

  1. Azure 门户中,选择应用服务。In the Azure portal, select your App Service.

  2. 单击“身份验证/授权” 菜单选项。Click the Authentication / Authorization menu option.

  3. 在“允许的外部重定向 URL” 中,输入 url_scheme_of_your_app://easyauth.callbackIn the Allowed External Redirect URLs, enter url_scheme_of_your_app://easyauth.callback. 此字符串中的 url_scheme_of_your_app 是移动应用程序的 URL 方案。The url_scheme_of_your_app in this string is the URL Scheme for your mobile application. 它应该遵循协议的正常 URL 规范(仅使用字母和数字,并以字母开头)。It should follow normal URL specification for a protocol (use letters and numbers only, and start with a letter). 应记下此字符串,因为在一些地方需要使用此 URL 方案调整移动应用代码。You should make a note of the string that you choose as you will need to adjust your mobile application code with the URL Scheme in several places.

  4. 单击 “确定”Click OK.

  5. 单击“保存” 。Click Save.

将权限限制给已经过身份验证的用户Restrict permissions to authenticated users

默认情况下,可匿名调用移动应用后端中的 API。By default, APIs in a Mobile Apps back end can be invoked anonymously. 接下来,需限制为仅可访问已验证的客户端。Next, you need to restrict access to only authenticated clients.

  • Node.js 后端(通过 Azure 门户)Node.js back end (via the Azure portal) :

    在移动应用设置中,单击“简易表” 并选择相应的表。In your Mobile Apps settings, click Easy Tables and select your table. 单击“更改权限” ,为所有权限选择“仅限已验证的访问” ,并单击“保存” 。Click Change permissions, select Authenticated access only for all permissions, and then click Save.

  • .NET 后端 (C#) :.NET back end (C#):

    在服务器项目中,导航到“控制器” > “TodoItemController.cs”。 In the server project, navigate to Controllers > TodoItemController.cs. [Authorize] 属性添加到“TodoItemController”类,如下所示。 Add the [Authorize] attribute to the TodoItemController class, as follows. 若要限制为仅可访问特定方法,还可只向这些方法应用此属性(而非类)。To restrict access only to specific methods, you can also apply this attribute just to those methods instead of the class. 重新发布服务器项目。Republish the server project.

    [Authorize]
    public class TodoItemController : TableController<TodoItem>
    
  • Node.js 后端(通过 Node.js 代码)Node.js backend (via Node.js code) :

    若要访问表时需验证身份,请向 Node.js 服务器脚本添加以下行:To require authentication for table access, add the following line to the Node.js server script:

    table.access = 'authenticated';
    

    有关更多详细信息,请参阅如何:要求在访问表时进行身份验证For more details, see How to: Require authentication for access to tables. 若要了解如何从站点下载快速入门代码项目,请参阅如何:使用 Git 下载 Node.js 后端快速入门代码项目To learn how to download the quickstart code project from your site, see How to: Download the Node.js backend quickstart code project using Git.

向可移植类库添加身份验证Add authentication to the portable class library

移动应用使用 MobileServiceClient 上的 LoginAsync 扩展方法通过应用服务身份验证登录用户。Mobile Apps uses the LoginAsync extension method on the MobileServiceClient to sign in a user with App Service authentication. 此示例使用服务器托管的身份验证流,在应用中显示提供程序的登录界面。This sample uses a server-managed authentication flow that displays the provider's sign-in interface in the app. 有关详细信息,请参阅服务器托管的身份验证For more information, see Server-managed authentication. 若要在生产应用中提供更好的用户体验,应考虑改用客户端托管的身份验证To provide a better user experience in your production app, you should consider instead using Client-managed authentication.

若要使用 Xamarin Forms 项目进行身份验证,请在可移植类库中为应用定义 IAuthenticate 接口。To authenticate with a Xamarin Forms project, define an IAuthenticate interface in the Portable Class Library for the app. 然后,将“登录”按钮添加到可移植类库中定义的用户界面,用户单击此按钮即可开始进行身份验证 。Then add a Sign-in button to the user interface defined in the Portable Class Library, which you click to start authentication. 身份验证成功后,将从移动应用后端加载数据。Data is loaded from the mobile app backend after successful authentication.

为应用支持的每个平台实现 IAuthenticate 接口。Implement the IAuthenticate interface for each platform supported by your app.

  1. 在 Visual Studio 或 Xamarin Studio 中,从名称中包含 Portable 的项目(该项目是可移植类库项目)中打开 App.cs,然后添加以下 using 语句 :In Visual Studio or Xamarin Studio, open App.cs from the project with Portable in the name, which is Portable Class Library project, then add the following using statement:

    using System.Threading.Tasks;
    
  2. 在 App.cs 中,在 App 类定义前添加以下 IAuthenticate 接口定义。In App.cs, add the following IAuthenticate interface definition immediately before the App class definition.

    public interface IAuthenticate
    {
        Task<bool> Authenticate();
    }
    
  3. 若要使用平台特定的实现初始化接口,可向 App 类添加以下静态成员。To initialize the interface with a platform-specific implementation, add the following static members to the App class.

    public static IAuthenticate Authenticator { get; private set; }
    
    public static void Init(IAuthenticate authenticator)
    {
        Authenticator = authenticator;
    }
    
  4. 从可移植类库项目中打开 TodoList.xaml,在 buttonsPanel 布局元素中现有按钮之后添加以下 Button 元素:Open TodoList.xaml from the Portable Class Library project, add the following Button element in the buttonsPanel layout element, after the existing button:

      <Button x:Name="loginButton" Text="Sign-in" MinimumHeightRequest="30" 
        Clicked="loginButton_Clicked"/>
    

    此按钮通过移动应用后端触发服务器托管的身份验证。This button triggers server-managed authentication with your mobile app backend.

  5. 从可移植类库项目中打开 TodoList.xaml.cs,并将以下字段添加到 TodoList 类:Open TodoList.xaml.cs from the Portable Class Library project, then add the following field to the TodoList class:

    // Track whether the user has authenticated. 
    bool authenticated = false;
    
  6. OnAppearing 方法替换为以下代码:Replace the OnAppearing method with the following code:

    protected override async void OnAppearing()
    {
        base.OnAppearing();
    
        // Refresh items only when authenticated.
        if (authenticated == true)
        {
            // Set syncItems to true in order to synchronize the data 
            // on startup when running in offline mode.
            await RefreshItems(true, syncItems: false);
    
            // Hide the Sign-in button.
            this.loginButton.IsVisible = false;
        }
    }
    

    该代码可确保仅在用户经过身份验证后,才从服务刷新数据。This code makes sure that data is only refreshed from the service after you have been authenticated.

  7. 在 TodoList 类中为 Clicked 事件添加以下处理程序 :Add the following handler for the Clicked event to the TodoList class:

    async void loginButton_Clicked(object sender, EventArgs e)
    {
        if (App.Authenticator != null)
            authenticated = await App.Authenticator.Authenticate();
    
        // Set syncItems to true to synchronize the data on startup when offline is enabled.
        if (authenticated == true)
            await RefreshItems(true, syncItems: false);
    }
    
  8. 保存更改,重新生成可移植类库项目,并验证没有错误。Save your changes and rebuild the Portable Class Library project verifying no errors.

向 Android 应用添加身份验证Add authentication to the Android app

本部分演示如何在 Android 应用项目中实现 IAuthenticate 接口。This section shows how to implement the IAuthenticate interface in the Android app project. 如果不要支持 Android 设备,请跳过本部分。Skip this section if you are not supporting Android devices.

  1. 在 Visual Studio 或 Xamarin Studio 中,右键单击 droid 项目,然后单击“设为启动项目” 。In Visual Studio or Xamarin Studio, right-click the droid project, then Set as StartUp Project.

  2. 按 F5 在调试器中启动项目,然后验证启动该应用后,是否会引发状态代码为 401(“未授权”)的未处理异常。Press F5 to start the project in the debugger, then verify that an unhandled exception with a status code of 401 (Unauthorized) is raised after the app starts. 因为后端上的访问仅限于授权用户,因此会生成 401 代码。The 401 code is produced because access on the backend is restricted to authorized users only.

  3. 在 Android 项目中打开 MainActivity.cs,并添加以下 using 语句:Open MainActivity.cs in the Android project and add the following using statements:

    using Microsoft.WindowsAzure.MobileServices;
    using System.Threading.Tasks;
    
  4. 更新 MainActivity 类,实现 IAuthenticate 接口,如下所示 :Update the MainActivity class to implement the IAuthenticate interface, as follows:

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity, IAuthenticate
    
  5. 通过添加 MobileServiceUser 字段和 IAuthenticate 接口所需的 Authenticate 方法,更新 MainActivity 类,如下所示 :Update the MainActivity class by adding a MobileServiceUser field and an Authenticate method, which is required by the IAuthenticate interface, as follows:

    // Define a authenticated user.
    private MobileServiceUser user;
    
    public async Task<bool> Authenticate()
    {
        var success = false;
        var message = string.Empty;
        try
        {
                // Sign in with MicrosoftAccount login using a server-managed flow.
            user = await TodoItemManager.DefaultManager.CurrentClient.LoginAsync(this,
                    MobileServiceAuthenticationProvider.MicrosoftAccount, "{url_scheme_of_your_app}");
            if (user != null)
            {
                message = string.Format("you are now signed-in as {0}.",
                    user.UserId);
                success = true;
            }
        }
        catch (Exception ex)
        {
            message = ex.Message;
        }
    
        // Display the success or failure message.
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.SetMessage(message);
        builder.SetTitle("Sign-in result");
        builder.Create().Show();
    
        return success;
    }
    

    如果使用的是 MicrosoftAccount 以外的其他标识提供者,请为 [MobileServiceAuthenticationProvider] 选择不同的值。If you are using an identity provider other than MicrosoftAccount, choose a different value for [MobileServiceAuthenticationProvider].

  6. <application> 元素内添加以下 XML,更新 AndroidManifest.xml 文件:Update the AndroidManifest.xml file by adding the following XML inside the <application> element:

    <activity android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity" android:launchMode="singleTop" android:noHistory="true">
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="{url_scheme_of_your_app}" android:host="easyauth.callback" />
      </intent-filter>
    </activity>
    

    {url_scheme_of_your_app} 替换为 URL 方案。Replace {url_scheme_of_your_app} with your URL scheme.

  7. 调用 LoadApplication() 之前,向 MainActivity 类的 OnCreate 方法添加以下代码 :Add the following code to the OnCreate method of the MainActivity class before the call to LoadApplication():

     // Initialize the authenticator before loading the app.
     App.Init((IAuthenticate)this);
    

    此代码可确保验证器在应用加载前进行初始化。This code ensures the authenticator is initialized before the app loads.

  8. 重新生成应用,运行它,使用所选的身份验证提供者登录,并验证是否能够以经过身份验证的用户身份访问数据。Rebuild the app, run it, then sign in with the authentication provider you chose and verify you are able to access data as an authenticated user.

故障排除Troubleshooting

应用程序崩溃并显示 Java.Lang.NoSuchMethodError: No static method startActivityThe application crashed with Java.Lang.NoSuchMethodError: No static method startActivity

在某些情况下,支持包中的冲突在 Visual Studio 中仅显示为警告,但应用程序在运行时会崩溃并显示此异常。In some cases, conflicts in the support packages displayed as just a warning in the Visual studio, but the application crashes with this exception at runtime. 在这种情况下,你需要确保在项目中引用的所有支持包都具有相同的版本。In this case you need to make sure that all the support packages referenced in your project have the same version. 对于 Android 平台,Azure 移动应用 NuGet 包具有 Xamarin.Android.Support.CustomTabs 依赖项,因此,如果你的项目使用较新的支持包,则你需要直接安装具有所需版本的此包以避免冲突。The Azure Mobile Apps NuGet package has Xamarin.Android.Support.CustomTabs dependency for Android platform, so if your project uses newer support packages you need to install this package with required version directly to avoid conflicts.

向 iOS 应用添加身份验证Add authentication to the iOS app

本部分演示如何在 iOS 应用项目中实现 IAuthenticate 接口。This section shows how to implement the IAuthenticate interface in the iOS app project. 如果不要支持 iOS 设备,请跳过本部分。Skip this section if you are not supporting iOS devices.

  1. 在 Visual Studio 或 Xamarin Studio 中,右键单击 iOS 项目,然后单击“设为启动项目” 。In Visual Studio or Xamarin Studio, right-click the iOS project, then Set as StartUp Project.

  2. 按 F5 在调试器中启动项目,然后验证启动该应用后,是否会引发状态代码为 401(“未授权”)的未处理异常。Press F5 to start the project in the debugger, then verify that an unhandled exception with a status code of 401 (Unauthorized) is raised after the app starts. 之所以会生成 401 响应,是因为对后端的访问仅限于授权用户。The 401 response is produced because access on the backend is restricted to authorized users only.

  3. 打开 iOS 项目中的 AppDelegate.cs,并添加以下 using 语句:Open AppDelegate.cs in the iOS project and add the following using statements:

    using Microsoft.WindowsAzure.MobileServices;
    using System.Threading.Tasks;
    
  4. 更新 AppDelegate 类,实现 IAuthenticate 接口,如下所示 :Update the AppDelegate class to implement the IAuthenticate interface, as follows:

    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate, IAuthenticate
    
  5. 通过添加 MobileServiceUser 字段和 IAuthenticate 接口所需的 Authenticate 方法,更新 AppDelegate 类,如下所示 :Update the AppDelegate class by adding a MobileServiceUser field and an Authenticate method, which is required by the IAuthenticate interface, as follows:

    // Define a authenticated user.
    private MobileServiceUser user;
    
    public async Task<bool> Authenticate()
    {
        var success = false;
        var message = string.Empty;
        try
        {
            // Sign in with MicrosoftAccount login using a server-managed flow.
            if (user == null)
            {
                user = await TodoItemManager.DefaultManager.CurrentClient
                    .LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController,
                        MobileServiceAuthenticationProvider.MicrosoftAccount, "{url_scheme_of_your_app}");
                if (user != null)
                {
                    message = string.Format("You are now signed-in as {0}.", user.UserId);
                    success = true;                        
                }
            }        
        }
        catch (Exception ex)
        {
           message = ex.Message;
        }
    
        // Display the success or failure message.
        UIAlertView avAlert = new UIAlertView("Sign-in result", message, null, "OK", null);
        avAlert.Show();         
    
        return success;
    }
    

    如果使用的是 MicrosoftAccount 以外的其他标识提供者,请为 [MobileServiceAuthenticationProvider] 选择不同的值。If you are using an identity provider other than MicrosoftAccount, choose a different value for [MobileServiceAuthenticationProvider].

  6. 通过添加 OpenUrl 方法重载更新 AppDelegate 类,如下所示:Update the AppDelegate class by adding the OpenUrl method overload, as follows:

     public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
     {
         return TodoItemManager.DefaultManager.CurrentClient.ResumeWithURL(url);
     }
    
  7. 调用 LoadApplication() 之前,向 FinishedLaunching 方法添加以下代码行 :Add the following line of code to the FinishedLaunching method before the call to LoadApplication():

    App.Init(this);
    

    该代码可确保验证器在应用加载前进行初始化。This code ensures the authenticator is initialized before the app is loaded.

  8. 打开 Info.plist 并添加 URL 类型Open Info.plist and add a URL Type. 将“标识符”设置 为所选的名称,将“URL 方案” 设置为应用的 URL 方案,将“角色” 设置为“无”。Set the Identifier to a name of your choosing, the URL Schemes to the URL scheme for your app, and the Role to None.

  9. 重新生成应用,运行它,使用所选的身份验证提供者登录,并验证是否能够以经过身份验证的用户身份访问数据。Rebuild the app, run it, then sign in with the authentication provider you chose and verify you are able to access data as an authenticated user.

向 Windows 10(包括 Phone)应用项目添加身份验证Add authentication to Windows 10 (including Phone) app projects

本部分演示如何在 Windows 10 应用项目中实现“IAuthenticate”接口。 This section shows how to implement the IAuthenticate interface in the Windows 10 app projects. 相同的步骤适用于通用 Windows 平台 (UWP) 项目,但使用的是 UWP 项目(具有已注明的更改) 。The same steps apply for Universal Windows Platform (UWP) projects, but using the UWP project (with noted changes). 如果不要支持 Windows 设备,请跳过本部分。Skip this section if you are not supporting Windows devices.

  1. 在 Visual Studio 中,右键单击“UWP”项目,然后单击“设为启动项目”。 In Visual Studio, right-click the UWP project, then Set as StartUp Project.

  2. 按 F5 在调试器中启动项目,然后验证启动该应用后,是否会引发状态代码为 401(“未授权”)的未处理异常。Press F5 to start the project in the debugger, then verify that an unhandled exception with a status code of 401 (Unauthorized) is raised after the app starts. 因为后端上的访问仅限于授权用户,因此会发生 401 响应。The 401 response happens because access on the backend is restricted to authorized users only.

  3. 打开 Windows 应用项目的 MainPage.xaml.cs,并添加以下 using 语句:Open MainPage.xaml.cs for the Windows app project and add the following using statements:

    using Microsoft.WindowsAzure.MobileServices;
    using System.Threading.Tasks;
    using Windows.UI.Popups;
    using <your_Portable_Class_Library_namespace>;
    

    <your_Portable_Class_Library_namespace> 替换为可移植类库的命名空间。Replace <your_Portable_Class_Library_namespace> with the namespace for your portable class library.

  4. 更新 MainPage 类,实现 IAuthenticate 接口,如下所示 :Update the MainPage class to implement the IAuthenticate interface, as follows:

    public sealed partial class MainPage : IAuthenticate
    
  5. 通过添加 MobileServiceUser 字段和 IAuthenticate 接口所需的 Authenticate 方法,更新 MainPage 类,如下所示 :Update the MainPage class by adding a MobileServiceUser field and an Authenticate method, which is required by the IAuthenticate interface, as follows:

    // Define a authenticated user.
    private MobileServiceUser user;
    
    public async Task<bool> Authenticate()
    {
        string message = string.Empty;
        var success = false;
    
        try
        {
            // Sign in with MicrosoftAccount login using a server-managed flow.
            if (user == null)
            {
                user = await TodoItemManager.DefaultManager.CurrentClient
                        .LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount, "{url_scheme_of_your_app}");
                if (user != null)
                {
                    success = true;
                    message = string.Format("You are now signed-in as {0}.", user.UserId);
                }
            }
    
        }
        catch (Exception ex)
        {
            message = string.Format("Authentication Failed: {0}", ex.Message);
        }
    
        // Display the success or failure message.
        await new MessageDialog(message, "Sign-in result").ShowAsync();
    
        return success;
    }
    

    如果使用的是 MicrosoftAccount 以外的其他标识提供者,请为 [MobileServiceAuthenticationProvider] 选择不同的值。If you are using an identity provider other than MicrosoftAccount, choose a different value for [MobileServiceAuthenticationProvider].

  6. 调用 LoadApplication() 之前,在 MainPage 类的构造函数中添加以下代码行 :Add the following line of code in the constructor for the MainPage class before the call to LoadApplication():

    // Initialize the authenticator before loading the app.
    <your_Portable_Class_Library_namespace>.App.Init(this);
    

    <your_Portable_Class_Library_namespace> 替换为可移植类库的命名空间。Replace <your_Portable_Class_Library_namespace> with the namespace for your portable class library.

  7. 如果使用的是“UWP”,则将以下“OnActivated”方法重写添加到“App”类: If you are using UWP, add the following OnActivated method override to the App class:

    protected override void OnActivated(IActivatedEventArgs args)
    {
        base.OnActivated(args);
    
         if (args.Kind == ActivationKind.Protocol)
         {
             ProtocolActivatedEventArgs protocolArgs = args as ProtocolActivatedEventArgs;
             MobileServiceClientExtensions.ResumeWithURL(TodoItemManager.DefaultManager.CurrentClient,protocolArgs.Uri);
         }
    }
    
  8. 打开 Package.appxmanifest,添加 Protocol 声明。Open Package.appxmanifest and add a Protocol declaration. 将“显示名称”设置 为所选的名称,将“名称” 设置为应用的 URL 方案。Set the Display name to a name of your choosing, and the Name to the URL scheme for you app.

  9. 重新生成应用,运行它,使用所选的身份验证提供者登录,并验证是否能够以经过身份验证的用户身份访问数据。Rebuild the app, run it, then sign in with the authentication provider you chose and verify you are able to access data as an authenticated user.

后续步骤Next steps

完成此基本身份验证教程后,请考虑继续学习以下教程之一:Now that you completed this basic authentication tutorial, consider continuing on to one of the following tutorials:

  • 向应用添加推送通知Add push notifications to your app

    了解如何为应用添加推送通知支持,以及如何将移动应用后端配置为使用 Azure 通知中心发送推送通知。Learn how to add push notifications support to your app and configure your Mobile App backend to use Azure Notification Hubs to send push notifications.

  • 为应用启用脱机同步Enable offline sync for your app

    了解如何使用移动应用后端向应用添加脱机支持。Learn how to add offline support your app using a Mobile App backend. 脱机同步允许最终用户与移动应用交互(查看、添加或修改数据),即使在没有网络连接时也是如此。Offline sync allows end users to interact with a mobile app - viewing, adding, or modifying data - even when there is no network connection.