Skip to content

Commit c423eba

Browse files
committed
CheckScheduledNotificationStatus() for explicit ID added
1 parent 1bc796a commit c423eba

File tree

1 file changed

+16
-0
lines changed
  • TestProjects/com.unity.mobile-notifications-sample/Assets/Scripts

1 file changed

+16
-0
lines changed

TestProjects/com.unity.mobile-notifications-sample/Assets/Scripts/AndroidTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class AndroidTest : MonoBehaviour
2222
private int _notificationExplicitID;
2323
private Button ButtonModifyExplicitID;
2424
private Button ButtonCancelExplicitID;
25+
private Button ButtonCheckStatusExplicitID;
2526

2627
public int notificationExplicitID
2728
{
@@ -32,6 +33,7 @@ public int notificationExplicitID
3233
bool buttonsEnabled = _notificationExplicitID != 0;
3334
ButtonModifyExplicitID.interactable = buttonsEnabled;
3435
ButtonCancelExplicitID.interactable = buttonsEnabled;
36+
ButtonCheckStatusExplicitID.interactable = buttonsEnabled;
3537
}
3638
}
3739

@@ -60,6 +62,7 @@ void OnNotificationReceivedHandler(AndroidNotificationIntentData notificationInt
6062
.Properties(notificationIntentData.Notification, 1);
6163
if (notificationIntentData.Id == notificationExplicitID)
6264
{
65+
AndroidNotificationCenter.CheckScheduledNotificationStatus(notificationExplicitID);
6366
notificationExplicitID = 0;
6467
}
6568
}
@@ -119,6 +122,8 @@ private void InstantiateAllTestButtons()
119122
//m_groups["Modify"]["Create notification preset"] = new Action(() => { });
120123
m_groups["Modify"]["Modify pending Explicit notification"] = new Action(() => { ModifyExplicitNotification(); });
121124
m_groups["Modify"]["Cancel pending Explicit notification"] = new Action(() => { CancelExplicitNotification(); });
125+
m_groups["Modify"]["Check status of Explicit notification"] = new Action(() => { CheckStatusOfExplicitNotification (); });
126+
122127

123128
m_groups["Send"] = new OrderedDictionary();
124129
foreach (AndroidNotificationTemplate template in Resources.LoadAll("AndroidNotifications", typeof(AndroidNotificationTemplate)))
@@ -130,6 +135,7 @@ private void InstantiateAllTestButtons()
130135
{
131136
Title = template.Title,
132137
Text = template.Text,
138+
133139
SmallIcon = template.SmallIcon,
134140
LargeIcon = template.LargeIcon,
135141
Style = template.NotificationStyle,
@@ -236,6 +242,9 @@ private void InstantiateAllTestButtons()
236242
ButtonModifyExplicitID.interactable = false;
237243
ButtonCancelExplicitID = GameObject.Find("Modify/Cancel pending Explicit notification").GetComponent<Button>();
238244
ButtonCancelExplicitID.interactable = false;
245+
ButtonCheckStatusExplicitID = GameObject.Find("Modify/Check status of Explicit notification").GetComponent<Button>();
246+
ButtonCheckStatusExplicitID.interactable = false;
247+
239248
m_gameObjectReferences.ButtonGroupTemplate.gameObject.SetActive(false);
240249
}
241250

@@ -261,6 +270,13 @@ public void CancelExplicitNotification()
261270
.Blue($"[{DateTime.Now.ToString("HH:mm:ss.ffffff")}] Call {MethodBase.GetCurrentMethod().Name}");
262271
}
263272

273+
public void CheckStatusOfExplicitNotification()
274+
{
275+
m_LOGGER
276+
.Blue($"[{DateTime.Now.ToString("HH:mm:ss.ffffff")}] Explicit notification (ID:{notificationExplicitID}) status: {AndroidNotificationCenter.CheckScheduledNotificationStatus(notificationExplicitID)}");
277+
278+
}
279+
264280
public void SendNotification(AndroidNotification notification, string channel = "default_channel", int notificationID = 0, bool log = true)
265281
{
266282
if (log)

0 commit comments

Comments
 (0)