天天看点

win8应用提交关于隐私政策的问题

微软对于win8 应用的提交要求可是非常非常地严格,尤其对于一些网络应用,如果你在开发win8应用时,将自己的应用作为的Internet客户端了,如图所示:

win8应用提交关于隐私政策的问题

那就必须要有相应的隐私政策。否则在提交应用的时候是不可能通过的。

隐私政策是提示用户本应用对用户信息的收集和处理的,一般是一个网址,例如:http://www.qq.com/privacy.htm。那么win8中如何实现隐私政策的说明呢?

win8种设计规范是将隐私政策作为超级按钮实现的,而且是全局调用的,所以在app.xaml.cs中加上如下的函数

protected override void OnWindowCreated(WindowCreatedEventArgs args)

        {

            SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested;

            base.OnWindowCreated(args);

        }

        void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs)

        {

            //表示处理在用户调用上下文菜单命令时引发的事件的回调函数。

            UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand);

            //创建表示设置项的设置命令对象。此设置命令可追加到 ApplicationCommands 矢量。

            SettingsCommand privacyStatement = new SettingsCommand("privacyStatement", "隐私政策", handler);

            //追加 SettingsCommand 对象,使这些对象可供 SettingsPane UI 使用。

            eventArgs.Request.ApplicationCommands.Add(privacyStatement);

        }

        //当命令调用时

        async void onSettingsCommand(IUICommand command)

        {

            SettingsCommand settingsCommand = (SettingsCommand)command;

            if (settingsCommand.Id.ToString() == "privacyStatement")

            {

                Uri pageUri = new Uri("你隐私政策的网址");

                await Windows.System.Launcher.LaunchUriAsync(pageUri);

            }

        }

继续阅读