In a VB.NET UWP app I am writing, I attempt to generate a local toast notification from an in-process background task. However, when I call show(toast) to display the notification, it does not display in the corner of my screen and goes directly to action center. Focus assist is not enabled on my machine, so I am unsure if the problem is caused by the termination of the background thread. How do I fix this and allow a local toast notification to pop up?
Oddly enough, a reboot seems to have solved my problem.
Related
I am working on a game on OSX with In App Purchases.
I am trying to detect when the Popup that says "Thank You, Your purchase was Successful." At the end of a successful Purchase by the user.
The Problem that I am having is I need to hide the mouse and resume input on the game after this message has been dismissed, but I can't find a suitable place to do this.
How can I find out if the OK button has been pressed on this message box?
Okay, so I found a fix to my problem.
I couldn't find a way to detect when an alert is shown from another Application, as all the the In App Purchase popups come from the App Store.
The fix I used was to make sure that the App Store was open before starting the transaction. This means that OS, whether or not you are in full screen, will automatically take you to the App Store. This causes the Alerts to be shown as sheets inside the App Store rather than in front of your application. Problem solved.
I open the App Store immediately before instigating the transaction by calling this line of code:
[[NSApp mainWindow] makeKeyAndOrderFront:[NSApp mainWindow]];
Then once the transaction finishes I grab focus on my App again.
I have a full screen DirectX drawing application which I've noticed looses focus when you get one of those Windows notifications. Is there a way to avoid this?
I'm new to Windows Phone development and I've found something about background agents in WP 7.5:
http://code.msdn.microsoft.com/wpapps/CSWP7ScheduledTaskAgent-6450bcf1
I wasn't able to find a way of making the toast notification fixed, I mean, when it appears on the screen it should disappear.
Is there any way of doing this? any advices, documentation should be great.
Thanks.
Toast Notification by the OS
When a toast notification is created, the OS handles the amount of time it is displayed for...
A toast notification displays for about 10 seconds unless the user
dismisses it with a flick to the right. If the user taps the toast, by
default, your app's start screen launches. Or, you can choose to
specify which screen of your app will launch.
Taken from the official documentation.
The API for toast notifications does not allow you to specify a time. Only a title, content and deep link into your app. This is the only type of toast/notification that can be used by a Background Agent. But it will appear:
on the Start screen
when your app is being used
when any other app is being used.
Custom toast-like notification (eg. Coding4Fun Toolkit's Toast Prompt)
A custom toast notification, although more flexible, must obey all the system rules unlike the system's Toast Notification which has special permissions.
This means the Coding4Fun Toolkit's Toast Prompt cannot:
Display notifications when your app is not running (apps cannot run in the background, they are essentially paused)
Display notifications when the user is on the Start screen or not using your app
Having a permanently (or long) displaying toast notification would be annoying to the user (hence the 10 second limit by the OS version) so do think carefully about why you need it - is the System Tray or MessageBox a better idea?
If you're new to Windows Phone, I would recommend using a handset for a while to get the feel for how the system works and how other apps use all kinds of notifications.
If I have a program running in the background and it needs the user to see it (like a dialog box) when it pops up, can I take the user out of Metro Mode (in Windows 8) for him to be able to see this notification?
I highly doubt it, such a capability would spawn a bunch of apps that would essentially try to take over and be very jarring for the user. Your desktop app though could generate a toast notification that would alert the user there is some action to take, see this MSDN topic for details.
I agree with Jim: switching context automatically from the desktop to Metro (or whatever they're calling it now) would be visually jarring and user-hostile. I realize the OS itself does this, like when you launch a desktop app from the Start screen. That doesn't make it good design.
Besides, when it does it, the user (presumably) wanted to interact with the newly-launched application. That's not necessarily the case when you're just showing a notification. There may not even be action required.
Instead, I recommend that you use Toast, the notification framework designed explicitly for this purpose. There's a sample application available for download: Sending toast notifications from desktop apps.
Note, however, that in order for Toast notifications to work from desktop applications, you must install a shortcut to your desktop application in the Start screen, with a System.AppUserModel.ID. This should be handled by your installer. More information is here.
Of course, the user can disable this by either turning off notifications or removing your app's shortcut from their Start screen. That's perfectly okay—if they take either of these actions, you can assume that they no longer want to receive notifications from your app.
On load of the the app will clear out all notifications in the notification center. How do I do that?
edit: I do not want to delete the actual notification, I want to clear the it from notification center (the swipe down menu). The notification is reoccurring so do not want to clear it.
This is the case; notification goes off, the phone is locked. The user unlocks the phone and does other things on the phone. Then later goes into my app. After exiting the app the notification center still shows the notification. Hope this makes more sense.