Skip to content

Commit 76517ac

Browse files
onesignal-deploycursoragentfadi-george
authored
feat: [SDK-5128] add explicit Android notification grouping to demos (#894)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Fadi George <fadi-george@users.noreply.github.com>
1 parent 2bb392c commit 76517ac

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎examples/demo-no-location/Assets/Scripts/NoLocationDemo.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public sealed class NoLocationDemo : MonoBehaviour
1212
private string _oneSignalAppId = "YOUR-ONESIGNAL-APP-ID";
1313

1414
private const float ReferenceWidth = 393f;
15+
private const string DemoAndroidGroup = "demo-group";
1516
private static readonly Color _backgroundColor = new Color32(248, 249, 250, 255);
1617
private static readonly Color _primaryColor = new Color32(229, 75, 77, 255);
1718
private static readonly Color _valueColor = new Color32(47, 52, 55, 255);
@@ -342,7 +343,8 @@ private async Task<bool> PostTestNotification(string pushSubscriptionId)
342343
+ $"\"app_id\":\"{_oneSignalAppId}\","
343344
+ $"\"include_subscription_ids\":[\"{pushSubscriptionId}\"],"
344345
+ "\"headings\":{\"en\":\"OneSignal No-Location Demo\"},"
345-
+ "\"contents\":{\"en\":\"This test push was sent without linking the location module.\"}"
346+
+ "\"contents\":{\"en\":\"This test push was sent without linking the location module.\"},"
347+
+ $"\"android_group\":\"{DemoAndroidGroup}\""
346348
+ "}";
347349

348350
using var request = new UnityWebRequest(

‎examples/demo/Assets/Scripts/Services/OneSignalApiService.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class OneSignalApiService
1818

1919
private const string DefaultAndroidChannelId = "b3b015d9-c050-4042-8548-dcc34aa44aa4";
2020

21+
private const string DemoAndroidGroup = "demo-group";
22+
2123
public void SetAppId(string appId) => _appId = appId;
2224

2325
public string GetAppId() => _appId;
@@ -178,6 +180,7 @@ private JObject BuildBasePayload(string title, string body, string subscriptionI
178180
["include_subscription_ids"] = new JArray(subscriptionId),
179181
["headings"] = new JObject { ["en"] = title },
180182
["contents"] = new JObject { ["en"] = body },
183+
["android_group"] = DemoAndroidGroup,
181184
};
182185

183186
// Retry while the OneSignal backend hasn't yet indexed the freshly

0 commit comments

Comments
 (0)