Windows 8 添加隱私策略(C++版)


well.新年上班第一天.不幸收到MS官方針對我們Snack Cards應用程序被打回消息.看看Report 內容如下:

The app has declared access to network capabilities and no privacy statement was provided in the Windows Settings Charm

如上文.Windows 8應用程序中一旦使用網絡連接則對應應用程序中需要對用戶說明隱私策略.其實這讓封裝功能透明化一種方式.有必要讓用戶知道隱私一些細節.這其實也是通用一種方式.App Store更像一個平台.同時這也是MS一份"免責聲明".但它打開的方式是放置在Windows 8 設置界面中.所以大部分用戶大多很少打開.東西雖小.但又或不可缺.這無疑也透漏一種開發商和最終用戶之間的"契約精神".

其實針對隱私策略Privacy Policy 問題官方已經說得很明確如下:

4.1.1 Your app must have a privacy statement if it is network-capable

If your app has the technical ability to transmit data, you must maintain a privacy policy. You must provide access to your privacy policy in the Description page of your app, as well as in the app’s settings as displayed in the Windows Settings charm.

App capability declarations that make your app network-capable include: internetClient, internetClientServer and privateNetworkClientServer.

Your privacy policy must inform users of the personal information transmitted by your app and how that information is used, stored, secured and disclosed, and describe the controls that users have over the use and sharing of their information, how they may access their information, and it must comply with applicable laws and regulations.

詳見:Windows 8 app certification requirements[windows]

在MS論壇上看到有人吐槽這個問題.其實問題很簡單.因為應用程序一旦使用到了網絡.其實在技術上有了實現傳輸用戶敏感隱私數據的條件.針對這點微軟官方必須強制維護一個隱私策略.其實就是一個網址.必須在你的應用的“描述”頁中以及在顯示於 Windows“設置”超級按鈕中的應用設置中提供對你的隱私策略的訪問途徑.

看到很多應用隱私策略做的很粗糙.其實官方要求隱私策略必須告知用戶你的應用傳輸的個人信息及如何使用、存儲、保護和透露該信息,並且描述用戶對使用和共享其信息.所具有的控制權以及他們訪問其信息的方式,並且隱私策略符合適用的法律和法規.一個完整的隱私策略需要包含哪些內容[標准如下]
 
Include Infor:
 
A:what information do we collect?
B:What do we use your information for?
C:How do we protect your information?
D:Do we use cookies?
E:Do we disclose any information to outside parties?
F:Contacting Us [Info]
或是可以參考我們制作一個隱私參考版[Snack Studio Privacy Policy Document].頁面有點粗糙.但內容較為完整規范.
說道這如何向Windows 8 應用程序添加隱私策略?
普遍方式在OnWindowsCreated事件中實現對隱私策略內容的添加[C#代碼]:
   1:  protected override void OnWindowCreated(WindowCreatedEventArgs args)
   2:  {
   3:         SettingsPane.GetForCurrentView().CommandsRequested += PrivacyCommandsRequested;           
   4:         base.OnWindowCreated(args);
   5:   }

處理CommandRequested事件處理函數:

   1:   void PrivacyCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs)
   2:      {
   4:          UICommandInvokedHandler eventHandler = new UICommandInvokedHandler(onSettingsCommand);
   5:          SettingsCommand privacyStatement = new SettingsCommand("SnackCardsPrivacy", "Privacy Policy", handler);
   6:          eventArgs.Request.ApplicationCommands.Add(privacyStatement);                    
   7:      }

當用戶點擊Privacy Policy 時調用如下代碼. 打開對應Url地址:

   1:  async void onSettingsCommand(IUICommand command)
   2:   {
   3:       if (command.Id.ToString() == "SnackCardsPrivacy")
   4:           await Windows.System.Launcher.LaunchUriAsync( new Uri("http://www.snack-studio.com/privacy.html"));
   5:   }

當用戶操作點擊隱私策略調用Launcher加載對應的Url地址.把網頁內容顯示在SettingPanel中.就是這么簡單.但是如果在Xaml和Direct X混合應用程序.按照同樣的思路來做的話.為了保證應用OnLaunch時間不超過5秒.推薦在應用程序中加載盡量減少操作.而是把這些操作放在MainPage 的OnLoaded或是OnNavigateTo事件中來加載.C++代碼需要添加如下額外引用:

   1:  using namespace Windows::UI::ApplicationSettings;
   2:  using namespace Windows::UI::Popups;

在文件中聲明操作事件如下:

   1:      public:
   2:          DirectXPage();        
   3:   
   4:          void SaveInternalState(Windows::Foundation::Collections::IPropertySet^ state);
   5:          void LoadInternalState(Windows::Foundation::Collections::IPropertySet^ state);
   6:          //Add  Privacy Policy
   7:          virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
   8:   
   9:      private:
  10:          void OnRendering(Object^ sender, Object^ args);
  11:          void PageLoaded(Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ args);
  12:   
  13:          //Add  Privacy Policy
  14:          void AddPrivacySetting(Windows::UI::ApplicationSettings::SettingsPane^ sender, Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs^ args);
  15:          void AddBtnPrivacy(Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs^ args);
  16:          void BtnPrivacyOnClicked(Windows::UI::Popups::IUICommand^ command);

在OnNavigatedTo事件作如下調用:

   1:  void DirectXPage::OnNavigatedTo(NavigationEventArgs^ args)
   2:  {   
   3:      SettingsPane::GetForCurrentView()->CommandsRequested += ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^>(this, &DirectXPage::AddPrivacySetting);
   4:  }

對應回調方法是AddPrivacySetting方法:

   1:  void DirectXPage::AddPrivacySetting(SettingsPane^ sender, SettingsPaneCommandsRequestedEventArgs^ args)
   2:  {
   3:      this->AddBtnPrivacy(args);
   4:  }
   5:   
   6:  void DirectXPage::AddBtnPrivacy(SettingsPaneCommandsRequestedEventArgs^ args)
   7:  {
   8:      UICommandInvokedHandler^ handler = ref new UICommandInvokedHandler(this, &DirectXPage::BtnPrivacyOnClicked); 
   9:      args->Request->ApplicationCommands->Clear();
  10:      SettingsCommand^ privacyPref = ref new SettingsCommand("CardPrivacyStament", "Privacy Policy", handler); 
  11:      args->Request->ApplicationCommands->Append(privacyPref);
  12:  }
  13:   
  14:  void DirectXPage::BtnPrivacyOnClicked(Windows::UI::Popups::IUICommand^ command)
  15:  {
  16:      using namespace Windows::Foundation; 
  17:      if(command->Id->ToString()=="CardPrivacyStament")
  18:      {
  19:         Windows::System::Launcher::LaunchUriAsync(ref new Uri("http://www.snack-studio.com/privacy.html"));
  20:      }
  21:  }

也很簡單.把C#邏輯改成C++版本.

參考資料:

Windows 8 app certification document [Windows 8]

Windows 8 Certification and add Privacy Policy


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM