c# - Trigger the Alarm in Windows Phone 8.1 Universal Store App? -
this seems work fine in windows 8.1 universal store app not in windows phone 8.1 universal store app. can tweaked work windows phone windows tablet?
xml file:
<toast duration="long" launch="alarm(eb6c47a8-e5e2-40d0-bc4e-3aa957f36484)"> <visual> <binding template="toastimageandtext04"> <text id="1">alarm app</text> <text id="2">alarm test</text> <text id="3">time wake up!</text> </binding> </visual> <audio loop="true" src="ms-winsoundevent:notification.looping.alarm2" /> <commands scenario="alarm"> <command id="snooze" /> <command id="dismiss" /> </commands> </toast>
notification class:
public class notification { public async task createnotification() { storagefolder storagefolder = package.current.installedlocation; var toast = await storagefolder.getfileasync("toast.xml"); var xml = await fileio.readtextasync(toast); notifyscheduled(xml); } private void notifyscheduled(string toast, int delay = 5, int snooze = 300, int maxsnoozecount = 3) { xmldocument document = new xmldocument(); document.loadxml(toast); var notifier = toastnotificationmanager.createtoastnotifier(); var scheduledtoast = new scheduledtoastnotification(document, datetime.now.addseconds(delay), timespan.fromseconds(snooze), (uint)maxsnoozecount); notifier.addtoschedule(scheduledtoast); } }
and implemented in phone's xaml.cs page:
var note = new notification(); note.createnotification();
the results should this:
but regular toast notification (which doesn't keep ring alarm until dismiss or snooze needs to):
like mentioned, can work fine in windows tablet (windows 8.1) , looks this:
edit: it's notable mention not snooze/dismiss buttons if tablet device not have app assigned default alarm app (there can 1 assigned). however, in windows phone 8.1, there not option define default alarm app can be.
unfortunately (as need alarms well), not seem possible @ moment.
here's article features in windows phone 8.0 , 8.1 , how map , can done where: http://msdn.microsoft.com/en-us/library/dn642486(v=vs.105).aspx
there's section (the first one) called
windows phone 8 features there no windows phone store equivalent
in it, can see
alarms , reminders
Comments
Post a Comment