File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
com.unity.mobile.notifications/Tests/Runtime/Android Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -329,4 +329,27 @@ public IEnumerator SendNotification_CanReschedule()
329
329
330
330
Assert . AreEqual ( 1 , currentHandler . receivedNotificationCount ) ;
331
331
}
332
+
333
+ [ UnityTest ]
334
+ [ UnityPlatform ( RuntimePlatform . Android ) ]
335
+ public IEnumerator SendNotificationNotShownInForeground_IsDeliveredButNotShown ( )
336
+ {
337
+ var n = new AndroidNotification ( ) ;
338
+ n . Title = "SendNotificationNotShownInForeground_ISDeliveredButNotShown" ;
339
+ n . Text = "SendNotificationNotShownInForeground_ISDeliveredButNotShown Text" ;
340
+ n . FireTime = System . DateTime . Now ;
341
+ n . ShowInForeground = false ;
342
+
343
+ Debug . LogWarning ( "SendNotificationNotShownInForeground_ISDeliveredButNotShown sends notification" ) ;
344
+
345
+ int originalId = AndroidNotificationCenter . SendNotification ( n , kDefaultTestChannel ) ;
346
+ yield return WaitForNotification ( 5.0f ) ;
347
+
348
+ Debug . LogWarning ( "SendNotificationNotShownInForeground_ISDeliveredButNotShown sends completed" ) ;
349
+
350
+ Assert . AreEqual ( 1 , currentHandler . receivedNotificationCount ) ;
351
+ yield return new WaitForSeconds ( 2.0f ) ; // give some time, since on some devices we don't immediately get infor on delivered notifications
352
+ var status = AndroidNotificationCenter . CheckScheduledNotificationStatus ( originalId ) ;
353
+ Assert . AreEqual ( NotificationStatus . Unknown , status ) ; // status should be unknown, rather than Delivered
354
+ }
332
355
}
You can’t perform that action at this time.
0 commit comments