@@ -22,6 +22,12 @@ import Foundation
22
22
import WatchKit
23
23
#endif // os(iOS) || os(tvOS)
24
24
25
+ #if SWIFT_PACKAGE
26
+ internal import GoogleUtilities_Environment
27
+ #else
28
+ internal import GoogleUtilities
29
+ #endif // SWIFT_PACKAGE
30
+
25
31
/// The SessionInitiator is responsible for:
26
32
/// 1) Running the initiate callback whenever a Session Start Event should
27
33
/// begin sending. This can happen at a cold start of the app, and when it
@@ -45,12 +51,22 @@ class SessionInitiator {
45
51
46
52
let notificationCenter = NotificationCenter . default
47
53
#if os(iOS) || os(tvOS) || os(visionOS)
48
- notificationCenter. addObserver (
49
- self ,
50
- selector: #selector( appBackgrounded) ,
51
- name: UIApplication . didEnterBackgroundNotification,
52
- object: nil
53
- )
54
+ // Change background update event listerner for iPadOS 26 multi-windowing supoort
55
+ if #available( iOS 26 , * ) , GULAppEnvironmentUtil . appleDevicePlatform ( ) . contains ( " ipados " ) {
56
+ notificationCenter. addObserver (
57
+ self ,
58
+ selector: #selector( appBackgrounded) ,
59
+ name: UIApplication . willResignActiveNotification,
60
+ object: nil
61
+ )
62
+ } else {
63
+ notificationCenter. addObserver (
64
+ self ,
65
+ selector: #selector( appBackgrounded) ,
66
+ name: UIApplication . didEnterBackgroundNotification,
67
+ object: nil
68
+ )
69
+ }
54
70
notificationCenter. addObserver (
55
71
self ,
56
72
selector: #selector( appForegrounded) ,
0 commit comments