Kanniyappan
Kanniyappan

Reputation: 197

Display splash page only on the 1st launch, or after a crash or a kill of the app

Could you please explain how to display splash page when only first launch or crash or kill the app in windows phone.

Upvotes: 2

Views: 115

Answers (1)

Farmer
Farmer

Reputation: 10983

You could use the IsolatedStorage to check if the app was opened before or not

private static bool hasSeenIntro;

/// <summary>Will return false only the first time a user ever runs this.
/// Everytime thereafter, a placeholder file will have been written to disk
/// and will trigger a value of true.</summary>
public static bool HasUserSeenIntro()
{
    if (hasSeenIntro) return true;

    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
    {
        if (!store.FileExists(LandingBitFileName))
        {
            // just write a placeholder file one byte long so we know they've landed before
            using (var stream = store.OpenFile(LandingBitFileName, FileMode.Create))
            {
                stream.Write(new byte[] { 1 }, 0, 1);
            }
            return false;
        }

        hasSeenIntro = true;
        return true;
    }
}

For the crash system, you could use BugSense for Windows Phone

Upvotes: 2

Related Questions