Make Mobile Notifications in Unity 2019! (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the mobile notifications package is a new way to manage mobile notifications on a user's iOS or Android device directly from inside of unity it adds support for scheduling and sending local notifications on Android on iOS it is intended to replace the notification services API and it implements the user notifications framework the mobile notifications package supports iOS 10 devices and above as well as Android devices running versions 4.4 API 19 and higher to get started using the mobile notifications package well first need to add it to our project from the package manager let's open the package manager by choosing window package manager and let's choose mobile notifications and click the install button now that we have the mobile notifications package installed we can start using the available features and manage the notifications that we'd like to send to our user the mobile notifications package allows us to schedule and repeat notifications based on the local time date or on iOS devices based on a location I've created a script to handle notifications if we take a look at it we can see that we can manage our notification channels on Android devices by using the Android notification channel struct here we can set the ID name description and importance level of our channel we then register the channel using a static call to the Android notification center class and with the channel setup we can create and send our first notification here i've set up a simple test notification to fire ten seconds after the application is started as you can see if we start the application on our android device and wait we get our notification sent through at the moment it's just using a default icon we can set icons for each of our notifications in the editor let's set our own icon for the notification instead to do this let's open the project settings window by choosing edit project settings and then choosing mobile notification settings in the mobile notification settings window we can manage our notification settings on Android and iOS devices to add an icon for our Android notifications let's add a new entry and let's select our white icon in the identifier field let's name our icon app underscore icon underscore small and we'll keep the type as small icon this will be used as the tray icon next let's add another entry this time we'll select the full like on and set it as our large icon with the identifier set to app underscore icon underscore large back in our notification script let's assign these icons to the small icon and large icon properties of our notification now when our notification fires on Android they have our custom icons assigned we can set different icons for each of our notifications this allows us to prioritize different visual assets for different categories of notifications and allow users to easily see what the notification is for to deliver local notifications on iOS you will need to request authorization you can enable the request authorization on app launch setting in the mobile notification settings window to automatically show a permission dialog when the application is launched once authorized we can send simple notifications by creating a new iOS notification on a time interval trigger and schedule it using the iOS Notification Center on iOS we can also trigger notifications based on the calendar using the iOS notification calendar trigger class or by location based on the iOS notification location trigger class with the mobile notifications package we can also easily track and cancel scheduled notifications on Android and iOS the send notification method returns an identifier when called we can use this to check if the notification has already been delivered and perform any action depending on the result it's worth noting however that notification status can only be tracked on android marshmallow 6.0 and above in this example when the application is paused I'm checking to see if the notification is scheduled and if it is I'll replace it with a different notification or if the notification has already been delivered we can remove the notification from the status bar if we wish to cancel an iOS notification before it was triggered it can be canceled using the remove scheduled notification method if the notification was already displayed to the user we can remove it from the notification center using the remove delivered notification method we can subscribe to notification events to receive a callback whenever a notification is delivered while the app is running using the notification received callback method on Android and the on remote notification received method on iOS both callbacks return various pieces of information about the notification that was received including the notification ID title text and channel on Android and the title body and subtitle on iOS we can also use get last notification intent on Android or the get last responded notification method on iOS to get the last notification received by the app these can also be used to check if a notification was used to open the app if the app was opened in any other way both methods will return null as you can see the new mobile notifications package makes it fast and easy to implement app notifications for mobile devices from inside of unity to learn more about the mobile notifications package or to get started by downloading the demo project and it tried for yourself follow the link in the description below alternatively for another look at this feature and to get an insight into how to send notifications to both Android and iOS with the same API call check out the sample project on the unity github thanks for watching you
Info
Channel: Unity
Views: 77,264
Rating: undefined out of 5
Keywords: Unity3d, Unity, Unity Technologies, Games, Game Development, Game Dev, Game Engine, unity mobile notifications, unity ios notifications, unity android notifications, unity notification, unity notifications, unity mobile notification, unity 2019 notifications, unity tutorial, unity mobile devlog, unity mobile game, unity make mobile, unity3d, unity 3d mobile, unity mobile game tutorial, unity how to make a mobile game, make mobile game, unity notifications package, unity2019, 2019
Id: XjxRL7Ax9-I
Channel Id: undefined
Length: 6min 11sec (371 seconds)
Published: Wed Sep 04 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.