I have some toast notifications with alarm scenario. I used the following toast schema, but when notification is raised, there are no buttons(snooze or dismiss).
Here is my xml content. So why cant i use this toast commands?
var contentString = "<toast duration=\"long\">\n" +
"<visual>\n" +
"<binding template=\"ToastText02\">\n" +
"<text id=\"1\">" + alarmTitle + "</text>\n" +
"<text id=\"2\">" + alarmNote + "</text>\n" +
"</binding>\n" +
"</visual>\n" +
"<commands scenario=\"alarm\">\n" +
"<command id=\"snooze\"/>\n" +
"<command id=\"dismiss\"/>\n" +
"</commands>\n" +
"<audio src=\"ms-winsoundevent:Notification.Looping.Alarm2\"\n" +
"loop=\"true\"/>\n" +
"</toast>\n";
As is normal, Windows Phone 8 RT does not have the all features of Windows Store Apps.
There is a link on the MSDN that says what is not available on WinRT apps.
One of the entries is Alarms and reminders, so sadly you will not be able to use alarms on WP8.1.
Related
I'm trying to display a toast notification after a timer run out of time.
The notification works on one of my PC's but the other one won't display it. I get no error when I'm debugging it.
I also tried to set something in the Settings>Notifications but in the list of apps which are allowed/not allowed to display notifications I can't see my application.
This is my Notifications Class:
class NewToastNotification
{
public NewToastNotification(string text)
{
string Toast = String.Format("<toast>"+
"<visual>+" +
"<binding template=\"ToastImageAndText04\">" +
"<text id = \"1\" >Toast Test </text>+" +
"<text id = \"2\" >{0}</text>+" +
"<text id = \"2\" >{1}</text>+" +
"</binding>+" +
"</visual>+" +
"</toast>", text, DateTime.Now);
var tileXml = new Windows.Data.Xml.Dom.XmlDocument();
tileXml.LoadXml(Toast);
var toast = new ToastNotification(tileXml);
ToastNotificationManager.CreateToastNotifier("1").Show(toast);
}
}
Use
ToastNotificationManager.CreateToastNotifier().Show(toast);
instead of
ToastNotificationManager.CreateToastNotifier("1").Show(toast);
I'm trying to create a secondary tile, which shows pictures in rotation like in the photos app. I have tried something like this:
SecondaryTile tile = GenerateSecondaryTile("NewTile", "SecondaryTile");
await tile.RequestCreateAsync();
var ImageUrl = selectedFileList.ElementAt(0).Path;
string tileXmlString =
"<tile>"
+ "<visual>"
+ "<binding template='TileSmall'>"
+ "<image src='" + selectedFileList.ElementAt(0).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(1).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(2).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(3).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(4).Path + "' alt='image'/>"
+ "</binding>"
+ "</visual>"
+ "</tile>";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(tileXmlString);
TileNotification notifyTile = new TileNotification(xmlDoc);
TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(notifyTile);
I have tried setting the type as both background and peek but it doesn't give the required result. And also I would not like to use a background task as my app already uses one and I wouldn't want to increase the overhead which might cause the task to fail entirely. I wouldn't mind if the images were limited to 5 like earlier in Windows phone 8.1.
For reference : check this out : Skip to 0:30
This is for Primary Tile, but it should work the same way. Make your own XML Template, then reference your image. Enable notification queue then update the Tile with the TileNotification. Do this up to five times to put five images on the Live Tile stack.
var myStorageFile = await Package.Current.InstalledLocation.GetFileAsync("LiveTileTemplate.xml");
string liveTileTemplate = await FileIO.ReadTextAsync(myStorageFile);
liveTileTemplate = liveTileTemplate.Replace("squareImageSource", FilePathFullPrefix + GetFilePathSquareTile(imageID));
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(mergedXML));
I use in my application ScheduledTileNotifications and push 10 until 20 messages in the TileUpdateManager. But on the metro there are only 5 messages active. What can I do to display more than 5 notifications in the metro-Tile?
string tileXmlString = "<tile>"
+ "<visual>"
+ "<binding template='TileWideSmallImageAndText03' branding='name'>"
+ "<image id='1' src='ms-appx:///Assets/icons/cube_for_kachel.png'/>"
+ "<text id='1'>" + longSubject + "\n" + message.title + "</text>"
+ "</binding>"
+ "<binding template='TileSquareText04' branding='name'>"
+ "<text id='1'>" + shortSubject + "\n" + message.title + "</text>"
+ "</binding>"
+ "</visual>"
+ "</tile>";
XmlDocument tileXml = new XmlDocument();
tileXml.LoadXml(tileXmlString);
ScheduledTileNotification sceduleNotification = new ScheduledTileNotification(tileXml, DateTime.Now.AddSeconds(15));
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(sceduleNotification);
When I set the EnableNotificationQueue to true, five of my notification run in a circle. When I set it to false, my notification donĀ“t run in a circle. But I have 10 until 20 Notifications, which should run in a circle. Do you think it is possible.
When I use the AddToSchedule method an push 10 Notifications, each notification will show for one time.
The problem is related to the use of the EnableNotificationQueue method. In fact, as you can read at http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.enablenotificationqueue:
When queuing is enabled, a maximum of five tile notifications can
automatically cycle on the tile.
Try to pass false to this method.
According to the documentation, you can schedule up to 4096 notifications. Reref to http://hansstan.wordpress.com/2012/09/02/windows-8-advanced-tile-badge-topics/ for a working example.
Quick question.
I did this:
myChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(myChannel_ShellToastNotificationReceived);
So if I receive a toast notification while the application is in the foreground the myChannel_ShellToastNotificationReceived function should be called. In that function I have:
void myChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
ApplicationTitle.Text = "Toast Notification Message Received";
});
}
The problem is that the function is never called and the ApplicationTitle is never changed.
Am I doing anything wrong?
I've found the problem...it seemed that the toast xml that was being sent was well enough formatted so the phone would receive it out of the app but not when it was inside it.
Wrote the xml by "hand" and didn't use xmlWriter and worked.
string toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Toast>" +
"<wp:Text1>" + title + "</wp:Text1>" +
"<wp:Text2>" + message + "</wp:Text2>" +
"</wp:Toast>" +
"</wp:Notification>";
I created a .NET class library in C# and exposed it to COM. It works fine as an in-proc COM server. However I want to use it as an out-proc COM server to have it in a separate process.
To do so I try to create a COM+ application. I created an empty COM+ application and added the classes implemented in the class library into it. When I call CoCreateInstance() to instantiate a class implemented in the library, the COM+ surrogate process encounters an access violation and terminates (crash dump folows).
Are there any special steps needed to be taken to create a class library that can be used as an out-proc COM server under COM+?
The COM+ surrogate process crashes with the following crash dump:
Exception: C0000005
Address: 0x000C1618
Call Stack:
! + 0xC1618
mscorwks!Ordinal79 + 0xE41C
mscorwks!Ordinal79 + 0xE4AD
mscorwks!CoInitializeEE + 0x563F
mscorwks!CoInitializeEE + 0x5672
mscorwks!CoInitializeEE + 0x57F1
mscorwks!CoInitializeCor + 0x210E
mscorwks!CoInitializeCor + 0x48D
mscorwks!Ordinal79 + 0x16D2
mscorwks!ReleaseFusionInterfaces + 0x20B28
COMSVCS! + 0xC29A2
COMSVCS! + 0xC2BDA
COMSVCS!CoCreateStdTrustable + 0xCB10
ole32!CoMarshalInterface + 0x2642
ole32!CoInstall + 0x673
ole32!CoQueryAuthenticationServices + 0x1F44
ole32!CoQueryAuthenticationServices + 0x2862
ole32!CoWaitForMultipleHandles + 0xC267
ole32!CoQueryClientBlanket + 0x16CE
ole32!CoCreateObjectInContext + 0xC8E
ole32!CoInstall + 0x87A
ole32!CoWaitForMultipleHandles + 0x10479
ole32!CoMarshalInterface + 0x2808
ole32!CoGetTreatAsClass + 0xBE7
ole32!CoGetTreatAsClass + 0xB9E
ole32!CoMarshalInterface + 0x28F2
ole32!CoMarshalInterface + 0x2642
COMSVCS!CoCreateStdTrustable + 0x106A4
ole32!CoMarshalInterface + 0x2642
ole32!CoPopServiceDomain + 0x14FE
RPCRT4!CheckVerificationTrailer + 0x70
RPCRT4!NdrStubCall2 + 0x215
RPCRT4!CStdStubBuffer_Invoke + 0x82
ole32!StgGetIFillLockBytesOnFile + 0xFC92
ole32!StgGetIFillLockBytesOnFile + 0xFC3C
ole32!CoRevokeClassObject + 0xA3E
ole32!CoRevokeClassObject + 0x963
ole32!StgGetIFillLockBytesOnFile + 0xF872
ole32!WdtpInterfacePointer_UserMarshal + 0x80E
ole32!StgGetIFillLockBytesOnFile + 0xF792
RPCRT4!NdrGetTypeFlags + 0x1C9
RPCRT4!NdrGetTypeFlags + 0x12E
RPCRT4!NdrGetTypeFlags + 0x5A
RPCRT4!CreateStubFromTypeInfo + 0x2D7
RPCRT4!CreateStubFromTypeInfo + 0x318
RPCRT4!NdrConformantArrayFree + 0x2CB
RPCRT4!NdrConformantArrayFree + 0x20F
RPCRT4!I_RpcBCacheFree + 0x61C
RPCRT4!I_RpcBCacheFree + 0x43E
RPCRT4!I_RpcBCacheFree + 0x604
kernel32!GetModuleFileNameA + 0x1B4
Perhaps going through the ServicedComponent example in this answer will help:
Create Out-Of-Process COM in C#/.Net?
I suggest you take a look at .Net Remoting instead.