Reputation: 9080
Am I doing something incorrectly with this?
My app went out last night, but I noticed that my code for the free trial wasn't firing. This method is being called and it always returning FALSE (Full Mode).
What am I doing wrong? Right now my app is free :(
private static Boolean IsTrial()
{
#if DEBUG
return false;
#endif
var license = new Microsoft.Phone.Marketplace.LicenseInformation();
return license.IsTrial();
}
Currently I have this app sideloaded on my machine. I am updating my pivot header and setting the status for the various checks I have. Right now in the SIDELOADED version it always returns false.
I downloaded my app from the MarketPlace last night (as a Free Trial). The production version is always returning False and so is the Sideloaded version.
Any ideas?
This is my calling code (just in case anyone is interested):
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
pivotPills.Title = "PillBox v1.2 - Checking Mode:";
App.ViewModel.RefreshTrialMode();
pivotPills.Title = "PillBox v1.2 - Count:" + App.ViewModel.trialItemCollection.Count.ToString();
//Checking Trial Mode:
if (App.ViewModel.trialItemCollection.Count == 0)
{
trialMode tm = new trialMode();
tm.IsTrial = true;
tm.Save();
pivotPills.Title = "PillBox v1.2 - Trial Mode:" + App.ViewModel.trialItemCollection.Count.ToString();
}
else
{
if (App.ViewModel.trialItemCollection[0].IsTrial == true) //If saved isTrial = true (still a trial) then check MarketPlace Task
{
if (IsTrial() == false) //Purchased App
{
App.ViewModel.trialItemCollection[0].IsTrial = false;
StorageHelper.Save<ObservableCollection<trialMode>>(App.trialModeData, App.ViewModel.trialItemCollection);
pivotPills.Title = "PillBox v1.2 - Unlimited";
}
else //Still in Trial Mode
{
//show marketplace window
NavigationService.Navigate(new Uri("/MarketPlace.xaml", UriKind.Relative));
}
}
}
}
Upvotes: 1
Views: 1380
Reputation: 65586
Are you sure that the version you submitted didn't contain the DEBUG directive?
Also the version in the Marketplace is version 1.0, but your code seems to think it's version 1.2. Is it just that the code your looking at doesn't match what's compiled/released?
Also your app crashes when I try and press the back button when selecting a contact. :(
Upvotes: 2
Reputation: 16319
The IsTrial
method always returns false when you are running in the emulator (which I presume is the case for you). Check out the How to: Test and Debug Your Trial Application for Windows Phone article on MSDN for help debugging trial applications.
Upvotes: 3