@@ -49,18 +49,23 @@ private static T GetSettingValue<T>(BuildTargetGroup target, string key)
49
49
/// </summary>
50
50
public static class AndroidSettings
51
51
{
52
+ internal static readonly string RESCHEDULE_ON_RESTART = "UnityNotificationAndroidRescheduleOnDeviceRestart" ;
53
+ internal static readonly string EXACT_ALARM = "UnityNotificationAndroidScheduleExactAlarms" ;
54
+ internal static readonly string USE_CUSTOM_ACTIVITY = "UnityNotificationAndroidUseCustomActivity" ;
55
+ internal static readonly string CUSTOM_ACTIVITY_CLASS = "UnityNotificationAndroidCustomActivityString" ;
56
+
52
57
/// <summary>
53
58
/// By default AndroidSettings removes all scheduled notifications when the device is restarted. Enable this to automatically reschedule all non expired notifications when the device is turned back on.
54
59
/// </summary>
55
60
public static bool RescheduleOnDeviceRestart
56
61
{
57
62
get
58
63
{
59
- return GetSettingValue < bool > ( BuildTargetGroup . Android , "UnityNotificationAndroidRescheduleOnDeviceRestart" ) ;
64
+ return GetSettingValue < bool > ( BuildTargetGroup . Android , RESCHEDULE_ON_RESTART ) ;
60
65
}
61
66
set
62
67
{
63
- SetSettingValue < bool > ( BuildTargetGroup . Android , "UnityNotificationAndroidRescheduleOnDeviceRestart" , value ) ;
68
+ SetSettingValue < bool > ( BuildTargetGroup . Android , RESCHEDULE_ON_RESTART , value ) ;
64
69
}
65
70
}
66
71
@@ -71,11 +76,11 @@ public static bool UseCustomActivity
71
76
{
72
77
get
73
78
{
74
- return GetSettingValue < bool > ( BuildTargetGroup . Android , "UnityNotificationAndroidUseCustomActivity" ) ;
79
+ return GetSettingValue < bool > ( BuildTargetGroup . Android , USE_CUSTOM_ACTIVITY ) ;
75
80
}
76
81
set
77
82
{
78
- SetSettingValue < bool > ( BuildTargetGroup . Android , "UnityNotificationAndroidUseCustomActivity" , value ) ;
83
+ SetSettingValue < bool > ( BuildTargetGroup . Android , USE_CUSTOM_ACTIVITY , value ) ;
79
84
}
80
85
}
81
86
@@ -86,11 +91,26 @@ public static string CustomActivityString
86
91
{
87
92
get
88
93
{
89
- return GetSettingValue < string > ( BuildTargetGroup . Android , "UnityNotificationAndroidCustomActivityString" ) ;
94
+ return GetSettingValue < string > ( BuildTargetGroup . Android , CUSTOM_ACTIVITY_CLASS ) ;
90
95
}
91
96
set
92
97
{
93
- SetSettingValue < string > ( BuildTargetGroup . Android , "UnityNotificationAndroidCustomActivityString" , value ) ;
98
+ SetSettingValue < string > ( BuildTargetGroup . Android , CUSTOM_ACTIVITY_CLASS , value ) ;
99
+ }
100
+ }
101
+
102
+ /// <summary>
103
+ /// A set of flags indicating whether to use exact scheduling and add supporting permissions.
104
+ /// </summary>
105
+ public static AndroidExactSchedulingOption ExactSchedulingOption
106
+ {
107
+ get
108
+ {
109
+ return GetSettingValue < AndroidExactSchedulingOption > ( BuildTargetGroup . Android , EXACT_ALARM ) ;
110
+ }
111
+ set
112
+ {
113
+ SetSettingValue < AndroidExactSchedulingOption > ( BuildTargetGroup . Android , EXACT_ALARM , value ) ;
94
114
}
95
115
}
96
116
@@ -155,18 +175,26 @@ public static void ClearDrawableResources()
155
175
/// </summary>
156
176
public static class iOSSettings
157
177
{
178
+ internal static readonly string REQUEST_AUTH_ON_LAUNCH = "UnityNotificationRequestAuthorizationOnAppLaunch" ;
179
+ internal static readonly string DEFAULT_AUTH_OPTS = "UnityNotificationDefaultAuthorizationOptions" ;
180
+ internal static readonly string ADD_PUSH_CAPABILITY = "UnityAddRemoteNotificationCapability" ;
181
+ internal static readonly string REQUEST_PUSH_AUTH_ON_LAUNCH = "UnityNotificationRequestAuthorizationForRemoteNotificationsOnAppLaunch" ;
182
+ internal static readonly string PUSH_NOTIFICATION_PRESENTATION = "UnityRemoteNotificationForegroundPresentationOptions" ;
183
+ internal static readonly string USE_APS_RELEASE = "UnityUseAPSReleaseEnvironment" ;
184
+ internal static readonly string USE_LOCATION_TRIGGER = "UnityUseLocationNotificationTrigger" ;
185
+
158
186
/// <summary>
159
187
/// It's recommended to make the authorization request during the app's launch cycle. If this is enabled the user will be shown the authorization pop-up immediately when the app launches. If it’s unchecked you’ll need to manually create an AuthorizationRequest before your app can send or receive notifications.
160
188
/// </summary>
161
189
public static bool RequestAuthorizationOnAppLaunch
162
190
{
163
191
get
164
192
{
165
- return GetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityNotificationRequestAuthorizationOnAppLaunch" ) ;
193
+ return GetSettingValue < bool > ( BuildTargetGroup . iOS , REQUEST_AUTH_ON_LAUNCH ) ;
166
194
}
167
195
set
168
196
{
169
- SetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityNotificationRequestAuthorizationOnAppLaunch" , value ) ;
197
+ SetSettingValue < bool > ( BuildTargetGroup . iOS , REQUEST_AUTH_ON_LAUNCH , value ) ;
170
198
}
171
199
}
172
200
@@ -177,11 +205,11 @@ public static AuthorizationOption DefaultAuthorizationOptions
177
205
{
178
206
get
179
207
{
180
- return GetSettingValue < AuthorizationOption > ( BuildTargetGroup . iOS , "UnityNotificationDefaultAuthorizationOptions" ) ;
208
+ return GetSettingValue < AuthorizationOption > ( BuildTargetGroup . iOS , DEFAULT_AUTH_OPTS ) ;
181
209
}
182
210
set
183
211
{
184
- SetSettingValue < AuthorizationOption > ( BuildTargetGroup . iOS , "UnityNotificationDefaultAuthorizationOptions" , value ) ;
212
+ SetSettingValue < AuthorizationOption > ( BuildTargetGroup . iOS , DEFAULT_AUTH_OPTS , value ) ;
185
213
}
186
214
}
187
215
@@ -192,11 +220,11 @@ public static bool AddRemoteNotificationCapability
192
220
{
193
221
get
194
222
{
195
- return GetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityAddRemoteNotificationCapability" ) ;
223
+ return GetSettingValue < bool > ( BuildTargetGroup . iOS , ADD_PUSH_CAPABILITY ) ;
196
224
}
197
225
set
198
226
{
199
- SetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityAddRemoteNotificationCapability" , value ) ;
227
+ SetSettingValue < bool > ( BuildTargetGroup . iOS , ADD_PUSH_CAPABILITY , value ) ;
200
228
}
201
229
}
202
230
@@ -207,11 +235,11 @@ public static bool NotificationRequestAuthorizationForRemoteNotificationsOnAppLa
207
235
{
208
236
get
209
237
{
210
- return GetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityNotificationRequestAuthorizationForRemoteNotificationsOnAppLaunch" ) ;
238
+ return GetSettingValue < bool > ( BuildTargetGroup . iOS , REQUEST_PUSH_AUTH_ON_LAUNCH ) ;
211
239
}
212
240
set
213
241
{
214
- SetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityNotificationRequestAuthorizationForRemoteNotificationsOnAppLaunch" , value ) ;
242
+ SetSettingValue < bool > ( BuildTargetGroup . iOS , REQUEST_PUSH_AUTH_ON_LAUNCH , value ) ;
215
243
}
216
244
}
217
245
@@ -222,11 +250,11 @@ public static PresentationOption RemoteNotificationForegroundPresentationOptions
222
250
{
223
251
get
224
252
{
225
- return GetSettingValue < PresentationOption > ( BuildTargetGroup . iOS , "UnityRemoteNotificationForegroundPresentationOptions" ) ;
253
+ return GetSettingValue < PresentationOption > ( BuildTargetGroup . iOS , PUSH_NOTIFICATION_PRESENTATION ) ;
226
254
}
227
255
set
228
256
{
229
- SetSettingValue < PresentationOption > ( BuildTargetGroup . iOS , "UnityRemoteNotificationForegroundPresentationOptions" , value ) ;
257
+ SetSettingValue < PresentationOption > ( BuildTargetGroup . iOS , PUSH_NOTIFICATION_PRESENTATION , value ) ;
230
258
}
231
259
}
232
260
@@ -237,11 +265,11 @@ public static bool UseAPSReleaseEnvironment
237
265
{
238
266
get
239
267
{
240
- return GetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityUseAPSReleaseEnvironment" ) ;
268
+ return GetSettingValue < bool > ( BuildTargetGroup . iOS , USE_APS_RELEASE ) ;
241
269
}
242
270
set
243
271
{
244
- SetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityUseAPSReleaseEnvironment" , value ) ;
272
+ SetSettingValue < bool > ( BuildTargetGroup . iOS , USE_APS_RELEASE , value ) ;
245
273
}
246
274
}
247
275
@@ -252,11 +280,11 @@ public static bool UseLocationNotificationTrigger
252
280
{
253
281
get
254
282
{
255
- return GetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityUseLocationNotificationTrigger" ) ;
283
+ return GetSettingValue < bool > ( BuildTargetGroup . iOS , USE_LOCATION_TRIGGER ) ;
256
284
}
257
285
set
258
286
{
259
- SetSettingValue < bool > ( BuildTargetGroup . iOS , "UnityUseLocationNotificationTrigger" , value ) ;
287
+ SetSettingValue < bool > ( BuildTargetGroup . iOS , USE_LOCATION_TRIGGER , value ) ;
260
288
}
261
289
}
262
290
}
0 commit comments