I implemented a toast with to open an url.
Here's the toast:
<toast>
<visual><binding template='ToastGeneric'><text>Go To bing.com</text></binding></visual></toast>
After that I added the handling to the OnStartAsync-Method:
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// navigates to Splash-Page
NavigationHelper.NavigationService = NavigationService;
NavigationService.Navigate(typeof(SplashPage));
// open the url
if (args is ToastNotificationActivatedEventArgs)
{
Windows.System.Launcher.LaunchUriAsync(new Uri("http://www.bing.com"));
}
return Task.FromResult<object>(null);
}
unfortunately the App crashes on the phone (it works like a charm on a desktop machine) every time I open the app with a tap on a notification with the following exeption (If I start the app without a tap on a notification, the normal way, it doesn't crash):
$exception {"Object reference not set to an instance of an object."} System.NullReferenceException
With the following stacktrace:
at Template10.Common.BootStrapper.<HandleResuming>d__99.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.ThrowAsync>b__6_0(Object state)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()
at Windows.ApplicationModel.Core.UnhandledError.Propagate()
at Microsoft.HockeyApp.Extensibility.Windows.UnhandledExceptionTelemetryModule.CoreApplication_UnhandledErrorDetected(Object sender, UnhandledErrorDetectedEventArgs e)" string
I can't figure out the problem by myself and need some help right here.
If I remove the line with the Launch the app doesn't crash.