---
title: "windows8开发-应用添加隐私权申明"
author: "mmdev"
date: "2012-12-21T00:52:00Z"
tags: []
slug: "windows8"
draft: false
lastmod: "2013-01-05T09:21:23Z"
id: 1759982
url: "https://mmdev.iteye.com/blog/1759982"
---

在win8应用提交规则里面有这么一条:

```
4.1 你的应用必须符合以下隐私相关要求：

4.1.1 如果你的应用支持连网使用，则它必须包含隐私声明

如果你的应用从技术角度而言能够传输任何用户的“个人信息”，则你必须维护一个隐私策略。你必须在你的应用的“描述”页

中以及在显示于 Windows“设置”超级按钮中的应用设置中提供对你的隐私策略的访问途径。

使你的应用可以联网使用的应用功能声明包括 internetClient、internetClientServer 和 privateNetworkClientServer。

你的隐私策略必须告知用户你的应用传输的个人信息及如何使用、存储、保护和透露该信息，并且描述用户对使用和共享其信息

所具有的控制权以及他们访问其信息的方式，并且隐私策略符合适用的法律和法规。
```

因此，只要是有联网的功能，都要包含隐私声明。

参考了部分资料（例如：[http://www.cnblogs.com/hebeiDGL/archive/2012/11/18/2775568.html](http://www.cnblogs.com/hebeiDGL/archive/2012/11/18/2775568.html)）后，实现了一下隐私权的声明。比较简单，详见源码:

```
        protected override void OnWindowCreated(WindowCreatedEventArgs args)
        {
            SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;  

            base.OnWindowCreated(args);
        }

        #region Private Methods

        /// <summary>
        /// 添加设置页面的命令项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            // 注册用户触发命令对象的回调函数
            UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand);			
            // 创建"隐私声明"命令对象
            SettingsCommand privacyStatement = new SettingsCommand("MyAppPrivacyStament", "隐私声明", handler);
            // 在SettingsPane中添加SeetingsCommand对象(隐私声明)
            args.Request.ApplicationCommands.Add(privacyStatement);
        }

        /// <summary>
        /// 响应"隐私声明"命令并跳转到相关页面
        /// </summary>
        /// <param name="command"></param>
        private async void onSettingsCommand(IUICommand command)
        {
            SettingsCommand settingsCommand = (SettingsCommand)command;

            if (settingsCommand.Id.ToString() == "MyAppPrivacyStament")
            {
                Uri privacyPageUri = new Uri("MyPrivacyPageUrl");
                await Launcher.LaunchUriAsync(privacyPageUri);
            }
        }

        #endregion
```

同时，在提交应用到商店时，在应用商店中的“附加条款”这一项也需要填写隐私声明的页面Url。