Hi,
I’m building an App which has some Calendar stuff in it. While compiling to iOS everything works fine. But when compiling on Android I get these errors:
Is the CalendarUnit not supported on Android? Or is this a bug?
Hi,
I’m building an App which has some Calendar stuff in it. While compiling to iOS everything works fine. But when compiling on Android I get these errors:
Is the CalendarUnit not supported on Android? Or is this a bug?
Sorry to bump this so soon but it really is something I need to fix…
Anyone?
The types declared by LocalNotifications and NotificationServices are supported only in Unity editor mode and on the iOS platform.
Attempting to build them on the Windows platform or Android, will not include the declaration and therefore will fail the compilation.
If you do plan to work it on the iOS, you can solve this by removing it from the standalone build on Windows / Android but keep it on the editor mode so that you can fill the data structure you need for the iOS.
For the Android you’d probably need to create your own plugin, or - look in the asset store which seems to have several small plugins that might support it.
To allow the compilation on Windows I used pre-processing macros as shown below - you can add the Android flag as well to avoid compilations error there (it will only work on iOS as I mentioned):
#if !UNITY_STANDALONE_WIN || UNITY_EDITOR
public CalendarUnit RepeatInterval; // Delay between notifications.
#endif
This worked fine for me and allowed storage of data to be used on the iOS.
Note that you’d need to get the user permissions for the notifications to display and work.