Skip to content

Commit 4f960d3

Browse files
authored
Merge pull request #158 from Unity-Technologies/min-android-api
Min android api update
2 parents 80e64b8 + a3bd8d3 commit 4f960d3

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

.yamato/upm-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ test_editors:
33
- version: 2022.1
44
- version: 2021.2
55
- version: 2020.3
6-
- version: 2019.4
76

8-
# 2019.4 fails due to issue unrelated to package
97
ios_test_editors:
108
- version: trunk
119
- version: 2022.1

TestProjects/NotificationSamples_2019_3/ProjectSettings/ProjectSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ PlayerSettings:
172172
iPhone: com.unity3d.mobilenotificationtests
173173
buildNumber: {}
174174
AndroidBundleVersionCode: 1
175-
AndroidMinSdkVersion: 20
175+
AndroidMinSdkVersion: 21
176176
AndroidTargetSdkVersion: 0
177177
AndroidPreferredInstallLocation: 1
178178
aotOptions: nimt-trampolines=1024

com.unity.mobile.notifications/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ All notable changes to this package will be documented in this file.
2020
- [Android] Added API which allows you to change notification icons in Editor.
2121
- [iOS] Correctly handle boolean values in UserInfo, previously boolean values were detected as numbers and get parsed as 1 or 0, now they will be correctly handled as 'true' and 'false'
2222
- [Android] Fixed notification package for Android 12 - NotificationRestartOnBootReceiver needs to be marked as exported in manifest file, disable exact alarms because they require special permissions.
23+
- [iOS] Fix NotificationSettings.iOSSettings.DefaultAuthorizationOptions having incorrect return type (was PresentationOption, now AuthorizationOption).
24+
- [iOS] Mobile Notifications 2.0.0: iOSNotificationTrigger.Type is no longer static and returns iOSNotificationTriggerType instead of int.
2325

2426
## [1.4.2] - 2021-07-22
2527

com.unity.mobile.notifications/Documentation~/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The Unity Mobile Notifications package adds support for scheduling local one-tim
55
### Requirements
66

77
- Compatible with Unity 2019.4 or above.
8-
- Compatible with Android 4.4+ (API 19) and iOS 10.0+.
8+
- Compatible with Android 5 (API 21) and iOS 10.0+.
99

1010
### Supported features
1111

com.unity.mobile.notifications/Editor/AndroidNotificationPostProcessor.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,25 @@ public class AndroidNotificationPostProcessor : IPostGenerateGradleAndroidProjec
1515

1616
public void OnPostGenerateGradleAndroidProject(string projectPath)
1717
{
18+
MinSdkCheck();
19+
1820
CopyNotificationResources(projectPath);
1921

2022
InjectAndroidManifest(projectPath);
2123
}
2224

25+
private void MinSdkCheck()
26+
{
27+
#if !UNITY_2020_2_OR_NEWER
28+
// API level 21 not supported since 2020.2, need to check for prior releases
29+
const AndroidSdkVersions kMinAndroidSdk = AndroidSdkVersions.AndroidApiLevel21;
30+
31+
if (PlayerSettings.Android.minSdkVersion < AndroidSdkVersions.AndroidApiLevel21)
32+
throw new NotSupportedException(string.Format("Minimum Android API level supported by notifications package is {0}, your Player Settings have it set to {1}",
33+
(int)kMinAndroidSdk, PlayerSettings.Android.minSdkVersion));
34+
#endif
35+
}
36+
2337
private void CopyNotificationResources(string projectPath)
2438
{
2539
// The projectPath points to the the parent folder instead of the actual project path.

0 commit comments

Comments
 (0)