How to make a fixed Toast notification - windows-phone-7

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.

Related

UWP Local Toast Notification Does Not Pop Up

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.

How to show the notify icon in taskbar for windows 7?

I implement a notify icon for my application by call Shell_NotifyIcon.
In the default, the notify icon display in the notify icon area instead of task bar in windows 7.
If the user want to show the notify icon in the task bar, he/she need to open the Notification Area Icons control panel item, find the application and set "Show icon and notifications" for the application.
I think it will be difficult to the user with poor windows knowledge. I want to implement this function that show the notify icon in the task bar in my VC++ code or installer. Is it possible? If yes, what should I do?
Appreciate.
No, this is not possible.
Windows 7 introduces a feature where notification icons can be hidden. It is an attempt to reduce the noise created by decades of developers dumping notification icons in the taskbar for no good reason.
In order for that feature to work effectively, there can't be a loophole for applications to get around it, because everyone thinks their application is the most important and the most deserving of prime real estate. Eventually, nothing is sacred anymore.
Raymond Chen has blogged about this very request, and provides some additional background info.
You just create the notification icon and provide the user with instructions in the documentation on how to show it permanently, if they so desire.
Why not just pin your application to the task bar? They can just click it and it will launch the application?

Is there any method to programmatically switch focus out of metro mode?

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.

Stop default launch of IE from an NFC "tap and send"

We have a very simple demo app with the Windows Phone map app sending a link via 'tap and send' to an NFC tablet. I can get and read the URL coming over, but Windows 8 pops over a purple bar in the top right asking if I want to receive content from another device, which then opens IE to the URL.
Is there an easy way to stop the default Windows behavior (not have the purple bar slide in)?
Thanks!
There is no way of disabling the toast pop-up and still have the OS launch the browser by default.
When not inside of a "metro style" app toast will always should for incoming proximity payloads such as an NFC tap, however if you are inside of your application you can subscribe to the proximity events and respond with your own user experiences, which means you don't have to show the toast. However when you are in the OS/Start Menu experience Windows always mandates the toast I'm afraid.
In addition; following on from the title of your question NFC tags respond based on the default program for the MIME type/extension on the tag (if using a URL). So if you want a custom experience instead of IE launching you can register your app again an extension or protocol such as map://mydataUrl and Windows will automatically launch your app when you acknowledge the toast popup.

put the application on trace

İ have a windows application. I made it in v.s 2008 with c#. I want to put it on trace when i m installing it. like windows messenger, yahoo messenger etc...
I can only guess that by 'trace' you mean the Taskbar Notification Area. To add an icon in the notification area you use a NotificationIcon component. To react to user interacting with your icon you add event handlers or set the ContextMenu to your notification icon. The MSDN help for the NotificationIcon has a sample on how to achieve most common tasks like hiding the form on close and activate it back on notification icon click.

Resources