Skip to content

Commit 19a3c44

Browse files
drewbatgitCopilot
andcommitted
Rewrite custom-audio and custom-timestamps, rename all files
- custom-audio-on-toasts -> custom-audio-on-notifications: remove namespace section, XML tab, broken links, add API link to SetAudioUri - custom-timestamps-on-toasts -> custom-timestamps-on-notifications: remove toast NOTE, XML tab, broken links, add API link to SetTimeStamp - notification-pending-update: rewrite with validated code - notification-progress-bar: cleanup pass with validated code - Update all cross-refs in content, index, toc, and redirects Co-authored-by: Copilot <[email protected]>
1 parent 8b9ca77 commit 19a3c44

8 files changed

Lines changed: 125 additions & 169 deletions

.openpublishing.redirection.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9568,14 +9568,24 @@
95689568
"redirect_url": "../../../develop/notifications/choosing-a-notification-delivery-method",
95699569
"redirect_document_id": false
95709570
},
9571+
{
9572+
"source_path": "hub/apps/develop/notifications/app-notifications/custom-audio-on-toasts.md",
9573+
"redirect_url": "custom-audio-on-notifications",
9574+
"redirect_document_id": true
9575+
},
9576+
{
9577+
"source_path": "hub/apps/develop/notifications/app-notifications/custom-timestamps-on-toasts.md",
9578+
"redirect_url": "custom-timestamps-on-notifications",
9579+
"redirect_document_id": true
9580+
},
95719581
{
95729582
"source_path": "hub/apps/design/shell/tiles-and-notifications/custom-audio-on-toasts.md",
9573-
"redirect_url": "../../../develop/notifications/app-notifications/custom-audio-on-toasts",
9583+
"redirect_url": "../../../develop/notifications/app-notifications/custom-audio-on-notifications",
95749584
"redirect_document_id": false
95759585
},
95769586
{
95779587
"source_path": "hub/apps/design/shell/tiles-and-notifications/custom-timestamps-on-toasts.md",
9578-
"redirect_url": "../../../develop/notifications/app-notifications/custom-timestamps-on-toasts",
9588+
"redirect_url": "../../../develop/notifications/app-notifications/custom-timestamps-on-notifications",
95799589
"redirect_document_id": false
95809590
},
95819591
{

hub/apps/develop/notifications/app-notifications/app-notifications-content.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ You can override the system-provided timestamp with your own timestamp that accu
267267

268268
![Screenshot of a notification in the Notifications Center with a custom timestamp](images/toast-content-custom-timestamp.png)
269269

270-
To learn more about using a custom timestamp, please see [custom timestamps on toasts](custom-timestamps-on-toasts.md).
270+
To learn more about using a custom timestamp, please see [Custom timestamps on app notifications](custom-timestamps-on-notifications.md).
271271

272272
### [Windows App SDK](#tab/appsdk)
273273

@@ -774,7 +774,7 @@ var builder = new AppNotificationBuilder()
774774

775775
---
776776

777-
See the [audio schema page](/uwp/schemas/tiles/toastschema/element-audio) for information on audio in app notifications. To learn how to send an app notification that uses custom audio, see [custom audio on toasts](custom-audio-on-toasts.md).
777+
See the [audio schema page](/uwp/schemas/tiles/toastschema/element-audio) for information on audio in app notifications. To learn how to send an app notification that uses custom audio, see [Custom audio on app notifications](custom-audio-on-notifications.md).
778778

779779

780780
## Scenarios
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
description: Learn how to use custom audio on your app notifications to let your app express your brand's unique sound effects.
3+
title: Custom audio on app notifications
4+
label: Custom audio on app notifications
5+
template: detail.hbs
6+
ms.date: 07/28/2025
7+
ms.topic: article
8+
keywords: windows 11, windows app sdk, winappsdk, notification, custom audio, sound
9+
ms.localizationpriority: medium
10+
---
11+
# Custom audio on app notifications
12+
13+
App notifications can use custom audio, which lets your app express your brand's unique sound effects. For example, a messaging app can use its own messaging sound on app notifications so that the user can instantly know the notification came from that app, rather than hearing the generic notification sound.
14+
15+
For more information about app notifications, see [App notifications overview](index.md).
16+
17+
## Add custom audio
18+
19+
Use [**AppNotificationBuilder.SetAudioUri**](/windows/windows-app-sdk/api/winrt/microsoft.windows.appnotifications.builder.appnotificationbuilder.setaudiouri) to specify a custom audio file for your notification.
20+
21+
```csharp
22+
using Microsoft.Windows.AppNotifications;
23+
using Microsoft.Windows.AppNotifications.Builder;
24+
25+
var notification = new AppNotificationBuilder()
26+
.AddText("New message")
27+
.SetAudioUri(new Uri("ms-appx:///Assets/Audio/CustomToastAudio.m4a"))
28+
.BuildNotification();
29+
30+
AppNotificationManager.Default.Show(notification);
31+
```
32+
33+
Supported audio file types:
34+
35+
- .aac
36+
- .flac
37+
- .m4a
38+
- .mp3
39+
- .wav
40+
- .wma
41+
42+
Supported audio file sources:
43+
44+
- ms-appx:///
45+
- ms-resource
46+
47+
Unsupported file sources:
48+
49+
- ms-appdata
50+
- http://, https://
51+
- C:/, F:/, etc.
52+
53+
## See also
54+
55+
- [App notifications overview](index.md)

hub/apps/develop/notifications/app-notifications/custom-audio-on-toasts.md

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Custom timestamps on app notifications
3+
description: Learn how to override the default timestamp on an app notification with a custom timestamp that indicates when the message or content was generated.
4+
label: Custom timestamps on app notifications
5+
template: detail.hbs
6+
ms.date: 07/28/2025
7+
ms.topic: article
8+
keywords: windows 11, windows app sdk, winappsdk, notification, custom timestamp, timestamp, Notification Center
9+
ms.localizationpriority: medium
10+
---
11+
# Custom timestamps on app notifications
12+
13+
By default, the timestamp on app notifications in Notification Center is set to the time that the notification was sent. You can optionally override the timestamp with your own custom date and time so that the timestamp represents the time the message or content was actually created, rather than the time the notification was sent. This also ensures that your notifications appear in the correct order within Notification Center, which is sorted by time.
14+
15+
:::image type="content" source="images/toast-content-custom-timestamp.png" alt-text="App notification with custom timestamp":::
16+
17+
For more information about app notifications, see [App notifications overview](index.md).
18+
19+
## Set a custom timestamp
20+
21+
Use [**AppNotificationBuilder.SetTimeStamp**](/windows/windows-app-sdk/api/winrt/microsoft.windows.appnotifications.builder.appnotificationbuilder.settimestamp) to override the default timestamp on your notification.
22+
23+
```csharp
24+
using Microsoft.Windows.AppNotifications.Builder;
25+
26+
var notification = new AppNotificationBuilder()
27+
.AddText("Matt sent you a friend request")
28+
.AddText("Hey, wanna dress up as wizards and ride around on hoverboards?")
29+
.SetTimeStamp(new DateTime(2017, 04, 15, 19, 45, 00, DateTimeKind.Utc))
30+
.BuildNotification();
31+
32+
AppNotificationManager.Default.Show(notification);
33+
```
34+
35+
## Usage guidance
36+
37+
We recommend that most apps specify a custom timestamp. This ensures that the notification's timestamp accurately represents when the message or content was generated, regardless of network delays, airplane mode, or the fixed interval of periodic background tasks.
38+
39+
For example, a news app might run a background task every 15 minutes that checks for new articles and displays notifications. Without a custom timestamp, the timestamp corresponds to when the notification was generated (always in 15-minute intervals). With a custom timestamp, the app can set it to the time the article was actually published. Similarly, email apps and social network apps can benefit from this feature if a similar pattern of periodic pulling is used for their notifications.
40+
41+
Providing a custom timestamp also ensures that the timestamp is correct even if the user was disconnected from the internet. For example, when the user turns their computer on and your background task runs, you can ensure that the timestamp represents the time the messages were sent, rather than the time the user turned on their computer.
42+
43+
## Default timestamp
44+
45+
If you don't provide a custom timestamp, the platform uses the time that your notification was sent.
46+
47+
- For push notifications sent through WNS, the timestamp is set to the time when the notification was received by the WNS server.
48+
- For local notifications, the timestamp is set to the time when the notification platform received the notification.
49+
50+
## See also
51+
52+
- [App notifications overview](index.md)

hub/apps/develop/notifications/app-notifications/custom-timestamps-on-toasts.md

Lines changed: 0 additions & 76 deletions
This file was deleted.

hub/apps/develop/notifications/app-notifications/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ This section provides design and implementation guidance for app notifications i
3232

3333
## Additional app notifications features
3434

35-
- [Custom audio on app notifications](custom-audio-on-toasts.md)
35+
- [Custom audio on app notifications](custom-audio-on-notifications.md)
3636
- [App notification progress bar and data binding](notification-progress-bar.md)
3737
- [App notification with pending update](notification-pending-update.md)
38-
- [Custom timestamps on app notifications](custom-timestamps-on-toasts.md)
38+
- [Custom timestamps on app notifications](custom-timestamps-on-notifications.md)
3939
- [App notification collections](notification-collections.md)
4040
- [App notification headers](notification-headers.md)
4141
- [Notification listener: Access all notifications](notification-listener.md)

hub/apps/develop/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,13 @@ items:
467467
- name: Additional features
468468
items:
469469
- name: Custom audio
470-
href: notifications/app-notifications/custom-audio-on-toasts.md
470+
href: notifications/app-notifications/custom-audio-on-notifications.md
471471
- name: Progress bar
472472
href: notifications/app-notifications/notification-progress-bar.md
473473
- name: Pending update
474474
href: notifications/app-notifications/notification-pending-update.md
475475
- name: Custom timestamps
476-
href: notifications/app-notifications/custom-timestamps-on-toasts.md
476+
href: notifications/app-notifications/custom-timestamps-on-notifications.md
477477
- name: Collections
478478
href: notifications/app-notifications/notification-collections.md
479479
- name: Headers

0 commit comments

Comments
 (0)