How to send Native Notifications on Android and iOS in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

ความคิดเห็น • 39

  • @Kutinski
    @Kutinski 2 หลายเดือนก่อน

    14:28 Oglądałem ten tutorial i tak coś czułem ten polski akcent xD
    Ale dobra robota z tym filmem :D

    • @blazeDev_vlog
      @blazeDev_vlog  2 หลายเดือนก่อน

      Ah, akcentu nie oszukasz 😅

  • @TshellAnimations
    @TshellAnimations ปีที่แล้ว

    brother thanks . i want to make unity sound running while the screen is of or locked

  • @J3FFBezos
    @J3FFBezos 2 หลายเดือนก่อน

    Thanks, clear tutorial!

  • @톰-l2o
    @톰-l2o 11 หลายเดือนก่อน

    Hi. I saw your fantastic tutorials. Vibration video, Notification video. Thanks of lot! :)

  • @khaa5zz81
    @khaa5zz81 ปีที่แล้ว +2

    i think your code is outdated. the documentaion show us how to request permission it it uses "var request = new PermissionRequest();" now Permession class

  • @juanortiz5190
    @juanortiz5190 4 หลายเดือนก่อน

    Great tutorial!
    Would it be possible to add a click event for when the user taps the notification while the app is in the foreground?

  • @samourai23
    @samourai23 ปีที่แล้ว

    Thanks for the tutorial

  • @JotalenG
    @JotalenG 6 หลายเดือนก่อน

    Thanks for the video, it really helped me, but I have a question. In 4:35, will it work if I change the line 34 for a variable type DateTime with the date and hour that I want to send the notification? And, if it would work, How?😅 Thanks again.😄😄

  • @brij3044
    @brij3044 ปีที่แล้ว

    Fantastic tutorial, thank you!

  • @stefancc83
    @stefancc83 8 หลายเดือนก่อน

    Nice tutorial. With the code as it is provided by you, every time the user opens the app, a new notification is scheduled. And also the nice badge is not shown. I liked your architecture, btw. i used to have one file and the code was a bit messy...

  • @JonathanVeit-wf9jy
    @JonathanVeit-wf9jy 9 หลายเดือนก่อน

    Amazing, thank you!

  • @Harshbadala127
    @Harshbadala127 9 หลายเดือนก่อน

    Bro it's work in my android api 33. I have to do on notification form app settings then its work but i want that notification popup show and user all and automatically on notification permission

    • @blazeDev_vlog
      @blazeDev_vlog  9 หลายเดือนก่อน

      Try combine with:
      if (!Permission.HasUserAuthorizedPermission("android.permission.POST_NOTIFICATIONS")) { Permission.RequestUserPermission("android.permission.POST_NOTIFICATIONS"); }
      somewhere at the beginning of your app loading logic

  • @AnyaT-p2u
    @AnyaT-p2u ปีที่แล้ว

    is there any way to set conditions for notifications? I want to access functions from other files in the program and send notifications based on the return value, and also if theres a way to get an apis response and send a notification based on that?

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      You need to know content of the notification when you schedule it. If its content changes after you schedule it you should remove previous schedule and set it again - however application need to be opened then. For any other cases you will probably need to use cloud based notification, I have a plan to create tutorial about it in the future 🙂

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      But generally content doesn’t have to be static, it can be dynamic. Just take values and put them in to content (if you know the content when scheduling).

  • @namxitrum2942
    @namxitrum2942 7 หลายเดือนก่อน

    How to send notification when user doesn't open the app?

    • @blazeDev_vlog
      @blazeDev_vlog  7 หลายเดือนก่อน +1

      You need to somehow schedule the notification. If you want to send notifications without this you need to use Firebase Cloud Messaging.

  • @HOCIJIKA
    @HOCIJIKA ปีที่แล้ว

    Great tutorial! Thanks 😊

  • @mayurrathod5873
    @mayurrathod5873 ปีที่แล้ว

    Great tutorial Mate!!!
    But, I have problem with iOS notification. Notification gets displayed when video ad is being played. I just want to display notifications when app is minimized or when app is closed. Any fix for this?

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว +2

      Thanks! Notifications are scheduled using iOS API so you need to handle when app launch and cancel all notifications and then set them again when app closes. There is no way to check if app is running when displaying notification sadly.

  • @carrrwoman
    @carrrwoman ปีที่แล้ว

    Great tutorial but, this is not working when the app is close, isn't it?

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      It is! When you set up notification to push eg. in 5 minutes it will be shown to user in 5 minutes even if the app is closed.

    • @carrrwoman
      @carrrwoman ปีที่แล้ว

      @@blazeDev_vlog but not if it is force closed, maybe I miss some configuration?

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      Hm, maybe force closing cause that system request is not proceed successfully. I’m not sure. Maybe it’s somehow system-dependent. I’m not sure if there is an option to avoid it. There is also second type of notifications, those one pushed from the server, but this is much more complicated than calling system API.

  • @TerafortLimited
    @TerafortLimited ปีที่แล้ว

    make a tutorial for Firebase cloud messaging, and how to implement permissions for showing notifications for IOS , there are no tutorials at all

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      Noted on my todo list, I will take a look at this. Thanks!

  • @aidenskeels
    @aidenskeels ปีที่แล้ว

    Bro, thank you. I was about to give up implementing the IOS one as I kept getting the errors and didn't know how to fix them without your help

  • @Asif-ze5hp
    @Asif-ze5hp ปีที่แล้ว

    Great

  • @MeetSondagar-p7g
    @MeetSondagar-p7g 10 หลายเดือนก่อน

    Bro Show me error:
    Severity Code Description Project File Line Suppression State
    Error CS0246 The type or namespace name 'AndroidNotificationChannel' could not be found (are you missing a using directive or an assembly reference?) Assembly-CSharp, Assembly-CSharp.Player C:\Users\DREAMWORLD\Work From Home Task\Assets\Scripts\AndroidNotificationsController.cs 20 Active
    Error CS0246 The type or namespace name 'AndroidNotification' could not be found (are you missing a using directive or an assembly reference?) Assembly-CSharp, Assembly-CSharp.Player C:\Users\DREAMWORLD\Work From Home Task\Assets\Scripts\AndroidNotificationsController.cs 32 Active
    Error CS0103 The name 'NotificationManager' does not exist in the current context Assembly-CSharp, Assembly-CSharp.Player C:\Users\DREAMWORLD\Work From Home Task\Assets\Scripts\AndroidNotificationsController.cs 27 Active
    Error CS0103 The name 'NotificationManager' does not exist in the current context Assembly-CSharp, Assembly-CSharp.Player C:\Users\DREAMWORLD\Work From Home Task\Assets\Scripts\AndroidNotificationsController.cs 37 Active
    Error CS0103 The name 'NotificationImportance' does not exist in the current context Assembly-CSharp, Assembly-CSharp.Player C:\Users\DREAMWORLD\Work From Home Task\Assets\Scripts\AndroidNotificationsController.cs 24 Active

    • @blazeDev_vlog
      @blazeDev_vlog  10 หลายเดือนก่อน

      It seems like you using Assembly Defines in your project. Because of that, reference will not be found automatically. You need to find Assembly Define you use with this script inside your project and manually add Unity.Notifications.Android (or Unity.Notifications.iOS for iOS) to the "Assembly Definition References" list.

  • @littledemo3605
    @littledemo3605 ปีที่แล้ว

    !permission.HasUserAuthorizePermission("text") what that means?

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      Hi! To send notification on newer Android versions (I'm not sure, but starting from Android 13 probably) you need to ask for permission to do that. This is what Permission.RequestUserPermission do. But when user respond for this permission (no matter if they agree or reject) we don't want to ask them anymore for this permission. Without this if statement the user would be asked for this permission on every game launching. 😅

    • @blazeDev_vlog
      @blazeDev_vlog  ปีที่แล้ว

      And the "text" is just the name of permission we want to ask for. In this case we ask for notification permission so we need to use "android.permission.POST_NOTIFICATIONS". Other permissions are listed in Android documentation.

    • @littledemo3605
      @littledemo3605 ปีที่แล้ว

      why i love unreal more than unity?@@blazeDev_vlog