Uni-Notification
Handful Unity-UNNotification Library.
##Dependency
- MiniJSON
- XUPorter
If you have already imported any of these two libraries, only XUPorter will cause namespace conflict, the namespace of the MiniJSON here has been changed to XUPorterMiniJSON in order to avoid the conflict. So, don't need to worry about MiniJSON here. However, if you have already used XUPorter and XUPorterMiniJSON in your project, that will be a little messy. Just do not check the import selection when importing this whole package.
There is still some code fixing job to be done.
##Structure
- ./Editor
Library for XUPorter, if you have already imported XUPorter in your project, make some code fixing as below.
- ./UniNotification
Main directory containing scripts, demo scene, asset images and iOS native library.
- ./UniResources
Place where you put the asset you want to import to your XCode Project. Also including mod file for XUPorter.
##Resource File
Most important feature about UNNotification is that you can display image or video in notifications. However, the image or the video that will be displayed in notifications should be stored in NSBundle, you can not load asset from a certain URL. So, you have to import these assets when building XCode Project by placing them in the directory UniResources/.
Take a look at typeNames and typePhases in PBX Editor/PBXFileReference.cs, if the file type of your importing asset has not been added yet, just add like following:
typeNames: { ".caf", "audio file" },
typePhases:{ ".caf", "PBXResourcesBuildPhase" },
##Usage
- Normal
_sendNotificationAfter(float seconds,string
message,string title,string subTitle,string requestIdentifier,bool isRepeat,string
soundName,string assetName)
If you don't need any custom sound or assets (including images and videos), just leave soundName and assetName with empty string.
- Calendar
_sendNotificationAtDate(int year,int month,int day,int
hour,int minute,int second,string message,string title,string subTitle,string
requestIdentifier,bool isRepeat,string soundName,string assetName)
Usage is the same as UNCalendarNotificationTrigger. Default value for year, month and day is -1, if you just want to run the nitification at 8:00 every day, just leave the year, month and day -1. Hour, minute and second could not be less than 0, they should be at least larger than 0, and data validation will be excuted inside the library while you should still check the value that will be passed into the library.
For example, if I want to send local notification on 20th in every month at 8:00, I should just call :
_sendNotificationAtDate(year:-1,month:-1,day:20,hour:8:minute:0,second:0)
If I want to send local notification every night at 22:30:30, I shoud just call :
_sendNotificationAtDate(year:-1,month:-1,day:-1,hour:22:minute:30,second:30)
- Location
_sendNotificationAtLocation(float longtitude, float
latitude, float radius,string message,string title,string subTitle,string
requestIdentifier,bool isRepeat,string soundName,string assetName);
Note that radius is a value in meters.
Support Email: cyh9211@icloud.com