Friday 26 April 2013

How to Add Privacy Policy To Your Windows 8 App



Open App.xaml.cs
Add this
using Windows.UI.ApplicationSettings;
using System;
Find 
protected override void OnLaunched(LaunchActivatedEventArgs args)
Now After
Window.Current.Activate();
Add this code before }
// You can put this event handler somewhere in a main class that runs your app.
// I put it in may main view model.
SettingsPane.GetForCurrentView().CommandsRequested += ShowPrivacyPolicy;
Now
Just After  }
Add This Code

// Method to add the privacy policy to the settings charm
private void ShowPrivacyPolicy(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
    SettingsCommand privacyPolicyCommand = new SettingsCommand("privacyPolicy","Privacy Policy", (uiCommand) => { LaunchPrivacyPolicyUrl(); });
    args.Request.ApplicationCommands.Add(privacyPolicyCommand);
}

// Method to launch the url of the privacy policy
async void LaunchPrivacyPolicyUrl()
{
    Uri privacyPolicyUrl = new Uri("http://www.yoursite.com/privacypolicy");
    var result = await Windows.System.Launcher.LaunchUriAsync(privacyPolicyUrl);
}
Thats It, 
Just Replace 
http://www.yoursite.com/privacypolicy 
with your privacy policy url

No comments:

Post a Comment