1

My App Building is almost complete and i want to add rate my app button, added a button and code but when i click on rate now app get closed..

XAML

<Page.BottomAppBar>
    <CommandBar Background="#2b2b2b" Foreground="White">
        <CommandBar.Content>
            <Grid/>
        </CommandBar.Content>            
        <AppBarButton Icon="Emoji2" Label="Rate" Foreground="White" Name="AppBarRateButton" Click="AppBarRateButton_Click" />            
    </CommandBar>
</Page.BottomAppBar>

C#

       private async void AppBarRateButton_Click(object sender, RoutedEventArgs e)


    {
        MessageDialog RateDialog = new MessageDialog("Rate this app?");
        RateDialog.Commands.Add(new UICommand("Rate now", async (command) =>
        {
            await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=9wzdncrdmtk6" + 
                Windows.ApplicationModel.Store.CurrentApp.AppId));
        }));
        RateDialog.Commands.Add(new UICommand("Not now"));
        RateDialog.DefaultCommandIndex = 0;
        RateDialog.CancelCommandIndex = 1;
        await RateDialog.ShowAsync();
    }

AppScreen

AppScreen

Popup

Popup

lokusking
  • 7,396
  • 13
  • 38
  • 57
Shubham Sahu
  • 1,963
  • 1
  • 17
  • 34
  • 2
    try this link, your scheme maybe out of date: https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/launch-store-app – Nghia Nguyen Aug 31 '16 at 05:01
  • By "app get closed" what you mean? It should open the store and find the rate page of your app, your app will not be in foreground any more. – Grace Feng Sep 01 '16 at 02:56
  • when i click on rate button ,a message box open and show rate now or not now, but when i click on rate now , instead of open store it closes the app – Shubham Sahu Sep 01 '16 at 04:24
  • your link is great shows "Launch the Windows Store app" uri ut there is something wrong with my code @NghiaNghia – Shubham Sahu Sep 01 '16 at 04:32

2 Answers2

8

I think the reason is that you are using the wrong identifier for the app.

The recommended solution is to use an alternate Windows Store URI, that references the package family name to identify the app. You can get this name using Windows.ApplicationModel.Package.Current.Id.FamilyName (a pretty long name, isn't it :-) )

First you have to add using statment to the top of the code-file:

using Windows.ApplicationModel;

And now you invoke the Windows Store for review like this:

await Launcher.LaunchUriAsync( 
    new Uri( $"ms-windows-store://review/?PFN={Package.Current.Id.FamilyName}" ) );
Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91
  • one more question for now my app is not in store , so when i click on rate it simply navigate to store, but when once it published , will it be navigate to my app page on store ? – Shubham Sahu Sep 03 '16 at 05:55
  • Yes, it will automatically work once published in Store. It doesn't work now, because the app is not yet associated with a Store Packagw Family Name and the app is not there, but the publishing process takes care of this :-) . – Martin Zikmund Sep 03 '16 at 06:33
  • can you answer any of my these three questions- http://stackoverflow.com/questions/40036513/go-forward-and-backward-fm-radio-frequency-on-back-and-forward-button-button-pre http://stackoverflow.com/questions/40013741/sound-through-speaker-and-earphone-both-or-from-speaker-only http://stackoverflow.com/questions/40020218/record-capture-curently-play-back-sound – Shubham Sahu Oct 14 '16 at 06:46
4

You can also use Universal Rate reminder.Get it from Nuget.

uwp
  • 107
  • 7