/// <summary>
        /// Tracks this application being launched. If the LaunchActivatedEventArgs
        /// parameter contains push data passed through from a Toast's "launch"
        /// parameter, then we extract and report information to correlate this
        /// application open with that push.
        /// </summary>
        /// <param name="launchArgs">The LaunchActivatedEventArgs available in an
        /// Application.OnLaunched override.</param>
        /// <returns>An Async Task that can be waited on or ignored.</returns>
        public static Task TrackAppOpenedAsync(ILaunchActivatedEventArgs launchArgs)
        {
            // Short-circuit if the Launch event isn't from an actual app launch.
            // We'll still phone home if the launchArgs passed in is null, though,
            // so here we only check for a non-Launch ActivationKind.
            if (launchArgs != null && launchArgs.Kind != ActivationKind.Launch)
            {
                return(((Task)null).Safe());
            }

            object pushHash;
            IDictionary <string, object> contentJson = ParsePush.PushJson(launchArgs);

            contentJson.TryGetValue("push_hash", out pushHash);
            return(ParseAnalytics.TrackAppOpenedWithPushHashAsync((string)pushHash));
        }
        /// <summary>
        /// Tracks this application being launched. If the LaunchActivatedEventArgs
        /// parameter contains push data passed through from a Toast's "launch"
        /// parameter, then we extract and report information to correlate this
        /// application open with that push.
        /// </summary>
        /// <param name="launchArgs">The LaunchActivatedEventArgs available in an
        /// Application.OnLaunched override.</param>
        /// <returns>An Async Task that can be waited on or ignored.</returns>
        public static Task TrackAppOpenedAsync(ILaunchActivatedEventArgs launchArgs)
        {
            // Short-circuit if the Launch event isn't from an actual app launch.
            // We'll still phone home if the launchArgs passed in is null, though,
            // so here we only check for a non-Launch ActivationKind.
            if (launchArgs != null && launchArgs.Kind != ActivationKind.Launch)
            {
                return(((Task)null).Safe());
            }

            IDictionary <string, object> contentJson = ParsePush.PushJson(launchArgs);
            object alert;
            string pushHash = null;

            if (contentJson.TryGetValue("alert", out alert))
            {
                pushHash = ParseAnalyticsUtilities.MD5DigestFromPushPayload(alert);
            }
            return(ParseAnalytics.TrackAppOpenedWithPushHashAsync(pushHash));
        }
 /// <summary>
 /// Tracks this application being launched.
 /// </summary>
 /// <returns>An Async Task that can be waited on or ignored.</returns>
 public static Task TrackAppOpenedAsync()
 {
     return(ParseAnalytics.TrackAppOpenedWithPushHashAsync());
 }