Sending Firebase Push Notifications - Firebase Cloud Messaging

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 223

  • @saifulislamsajon5641
    @saifulislamsajon5641 4 роки тому +29

    I don't know how should I appreciate you, but I would like to thank you for this kind of tutorial that someone ever made. I am supporting you by watching all the adds and clicking on that adds sometimes...thank you so much again

  • @Amandeep-uc7qh
    @Amandeep-uc7qh 3 роки тому +6

    This is just awesome
    I was search for this from 2 days and finally I found this video
    Thanks man, really appreciate your work🙌

  • @reubensabisa9298
    @reubensabisa9298 3 роки тому +1

    This is the best tutorial on firebase I've watched. Though I'm from the java world, I can still understand the step. I was somehow stuck but not anymore. Thanks for the video

    • @droidtek
      @droidtek 3 роки тому

      Hello Bro, can you share your Java code plz, I'm a beginner with Java knowledge only.

    • @rabihmaroun225
      @rabihmaroun225 3 роки тому

      plz we need the java code ??

  • @i-am-learning-life
    @i-am-learning-life 4 роки тому +2

    You just solved the problem of Saving data from firebase to Android apps. 😍😍😍

  • @heckvideos
    @heckvideos 3 роки тому +2

    As the name suggests "Server key" is meant to be sorted on a server. It is not at all recommended to have you server key on your client app. As apps can be reverse engineered and then the key can be used in unwanted ways. You should have a server which interacts with your client app to send notifications using fcm.

  • @VijayKumar-fb2mj
    @VijayKumar-fb2mj 3 роки тому +1

    Really helpful. Wish to watch all your videos. Keep posting the videos on advanced topics. Thanks

  • @mikelantzelo
    @mikelantzelo Рік тому +2

    Great content but now outdated. Can you upload new video for this? I tried to find some working solution but not succeeded.Thank you for excellent content you share !

  • @zmemes69
    @zmemes69 4 роки тому +1

    oooof after searching for 4 hours
    i hope it's the right video
    it's look like the right one from the beginning

  • @kifahandary8126
    @kifahandary8126 2 роки тому

    i searched everywhere for a sample of this kind of Firebase cloud messaging now i've understand what the token is really for

  • @GoodSmile3
    @GoodSmile3 3 роки тому +1

    Great tutorial, turns out to be much easier than expected after reading the docs. The only question I have now, can we actually schedule these messages via API? To make notifications not pop up immediately. Or we have to manually schedule them when we receive a message from Firebase?

  • @adeltarek9114
    @adeltarek9114 4 роки тому +3

    So amazing bro as usual, keep going ✌️
    And please extend your firebase series with playlist for "firebase ML kit" 😍

  • @emmanuelonwumah915
    @emmanuelonwumah915 3 роки тому

    This may be your best vid

  • @jakariamasudliton
    @jakariamasudliton 4 роки тому +1

    Want more and more videos on advanced topics....keep it up.....

  • @soufianeaouri6205
    @soufianeaouri6205 4 роки тому +1

    For those who receive 200 OK from the server but the notification does not show, I had the same issue and I managed to fix it. Actually, even if you receive 200 OK, there is an error in the body (try to do it in postman or debug deeply in your client to see it). The response body actually has a field ""results":[{"error":"InvalidRegistration"}]" or another error type. In my case in a first time, I was using the topic /topics/myTopic and it seems to be forbidden to use such format. Then I replaced the topic with the device Id as shown in the video and it works. I would/will dig into the topic problems when I need it :) Anyway, the "results" should have a "message_id" field to be sur it is working !

    • @newbiegameplayy
      @newbiegameplayy 3 роки тому

      So, you change TOPIC with Device id? or what?

  • @Hostqxa
    @Hostqxa 3 роки тому +1

    Love you from India 🇮🇳🇮🇳🇮🇳

  • @cheezeyes5057
    @cheezeyes5057 3 роки тому

    Wow... Awesome Tutorial. Thanks for sharing the source code link in description....

  • @walidayari7366
    @walidayari7366 Рік тому

    great work ,i recommended with simple chat app

  • @rahuljangir7100
    @rahuljangir7100 3 роки тому +2

    this video save my day...................... thanks a lot

  • @mathias0584
    @mathias0584 3 роки тому +2

    Cool! But how do you add an image to the notification along with the title and message?

    • @the_phoenixg
      @the_phoenixg Рік тому

      hi sir did you find out how to do it ???? if yes please tell me how

  • @aryanvikash1967
    @aryanvikash1967 4 роки тому +2

    Haven't started yet.. but I know gonna be awesome ♥️🤪

  • @sabghat90
    @sabghat90 Рік тому

    Thanks, successfully implemented push notification.

    • @krunaldhapodkar3741
      @krunaldhapodkar3741 Рік тому

      Will this be applicable if two apps are connected to firebase like admin app and user app where admin want to send notifications to user app

  • @shariqkhan2463
    @shariqkhan2463 4 роки тому +3

    There is no c2dm permission in official docs. Why we used that?

  • @ИванЕмелин-ш9ш
    @ИванЕмелин-ш9ш Рік тому

    Hi, Philipp, thank you, you are the best❤

  • @nkp2877
    @nkp2877 2 роки тому +2

    if you face this error : MediaSessionCompat:Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
    then change the pending intent code as below
    val pendingIntent: PendingIntent? = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
    PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_MUTABLE)
    } else {
    PendingIntent.getActivity(this, 0, intent, FLAG_ONE_SHOT)
    }

  • @mrchispa4541
    @mrchispa4541 3 роки тому

    Hello Philipp and tank you for these tutorials, i have a question, why we are saving the token in sharedPref? i mean, why is this a good practice?

  • @annguyenhoang3589
    @annguyenhoang3589 4 роки тому +2

    Love it, hope that you can make a list of tutorials that using exoplayer and custom it like youtube. I'd got stuck at it for weeks. I didn't know how to make a setting resolution (bitrate) button for mp4 adaptive stream. I hope that you can make a tutorial about it.

  • @rawat_ji5183
    @rawat_ji5183 2 роки тому +1

    Works perfectly

  • @안인섭-q9o
    @안인섭-q9o 2 роки тому +1

    I really fucking hate indian English pronunciation. You can't imagine how thankful I am for your pronunciation of this tremendous content:)

  • @veenkumaar
    @veenkumaar 3 роки тому

    This video is very helpful for me, good work keep going. I appreciate your work ;)

  • @maskedredstonerproz
    @maskedredstonerproz 4 роки тому +2

    Been looking for a good way to send notifications to the user, hope this works for what I want it

    • @PhilippLackner
      @PhilippLackner  4 роки тому +1

      This should be what you're searching for

    • @ahmedhegazi8039
      @ahmedhegazi8039 4 роки тому

      There is an easy way called one signal

    • @maskedredstonerproz
      @maskedredstonerproz 4 роки тому

      @@PhilippLackner is there a way to add functional buttons to the notification, that can manipulate stuff in the app??

    • @PhilippLackner
      @PhilippLackner  4 роки тому

      @@ahmedhegazi8039 yea, but firebase is more popular and known in the android community, so I thought this helps more people

    • @PhilippLackner
      @PhilippLackner  4 роки тому +1

      @@maskedredstonerproz yes that's possible, you have a lot of possibilities, it's all stated in the docs

  • @ferrianrp
    @ferrianrp 3 роки тому

    Bro, i really appreciate you when give me explanation code by code. Thanks for that

  • @jamiehill2783
    @jamiehill2783 2 роки тому

    thanks for the video very helpful and informative!

  • @fatigurqiti2780
    @fatigurqiti2780 2 роки тому

    Thank you so much. This helped me a lot :)

  • @smoybelizaire4100
    @smoybelizaire4100 2 роки тому

    Just amazing 👏🏿 😍 🙌 ❤️ I love you

  • @hoangphungvan8289
    @hoangphungvan8289 3 роки тому

    Awsome work my man. Thank u

  • @Basirafeef
    @Basirafeef Рік тому

    hello sir how to use the new fcm api? please make a video about new firebase fcm.

  • @mrwaseemmalik5766
    @mrwaseemmalik5766 4 роки тому

    Love it and liked and subscribed

  • @steph291
    @steph291 3 роки тому

    my next project is :building an alternative to firebase. Curious to experiment with a 'binary local database creation" approach.
    Like in pure C.

  • @arafath8380
    @arafath8380 3 роки тому

    Thank you soo much for this tutorial !!!!!

  • @hemahanny8874
    @hemahanny8874 3 роки тому +1

    how I can add it to my java project?
    and how I can save this notification or some specifide notifiacation on my realtime database?
    I want to get and save notification by data change on any one of my fragments?

  • @franciscojaviercristobalfe4519
    @franciscojaviercristobalfe4519 3 роки тому +1

    Congratulations for your channel and thanks for sharing your knwledge: always great content!!! In this tutorial, on pressed the button to send the notification I get this error: "java.lang.SecurityException: Can not make a java.lang.reflect.Method constructor accessible" Only this line in the log console and nothing happens. Any idea to solved it?

  • @dawoodamir2011
    @dawoodamir2011 4 роки тому +1

    Good content as always

  • @thuraaung5047
    @thuraaung5047 3 роки тому

    Awesome tutorial!

  • @ketankatdare2102
    @ketankatdare2102 3 роки тому

    Philipp, your tutorials are wonderful and helps a lot. Just one query regarding FCM notification, some devices with custom android or battery optimization features or autostart prevention feature, do not display notification if app is not in use for some time (e.g. hours). Is there any robust solution?

  • @Laithabujbara
    @Laithabujbara 2 роки тому

    Great tutorial

  • @MultiBuzzTube
    @MultiBuzzTube 4 роки тому

    Hi thank you very much for your wonderful videos... can you talk about gradle, building sdk for clients , and proguard configuration

  • @buddheshborkar4037
    @buddheshborkar4037 4 роки тому

    Thankyou very much ! It works

  • @lyndon562
    @lyndon562 3 роки тому

    Good day Phillip, will this implementation work on Huawei devices as well?

  • @sebastianandresmoralesalva7016
    @sebastianandresmoralesalva7016 3 роки тому

    Por fin un weon que habla normal por la chucha

  • @Zizo1st
    @Zizo1st 4 роки тому

    Good job well done!, but I have a question if you please, I want to call this push notification method in my java project from another Activity, I already inserted your code tp a separated package inside my Android Java project and tested it and it works well, but how can I call this kotlin method (PushNotification) from another Java file (Activity)? I am stuck at this point.
    I know that we can call kotlin methods from Java, but how can we do this in my situation?

  • @raheemadamboev
    @raheemadamboev 2 роки тому

    Thank you so much!

  • @anillip1
    @anillip1 4 роки тому +2

    Do you have with Aws sns for sending notifications for android using nodeJS and mongodb as a db to store tokens?

  • @cptsakamoto
    @cptsakamoto 4 роки тому

    Thanks for video this helped me a lot

  • @suprajeff
    @suprajeff 3 роки тому

    Great video ! It worked perfectly between all my android devices. But it doesn't reach my iphone. (I have tried to send notification to topics from firebase directly and it reached all my devices android and IOS). Is there anything we have to change in the android app to be able to reach IOS devices ?

  • @piper28mudai
    @piper28mudai 4 роки тому +1

    Hi.. love it, this what im trying to do, without backend server, do you have the code in java ? i have try to guess translate to java, but seem didnt work ....

    • @kaff864
      @kaff864 4 роки тому

      hi sorry to say you can enable kotlin for exiting java project

  • @zmemes69
    @zmemes69 4 роки тому +1

    Kotlin seriously damn
    however good job sir keep going i know you worked so hard to make this video you deserve a subscribe even it wasn't useful for me

    • @PhilippLackner
      @PhilippLackner  4 роки тому +1

      Thanks, I would really recommend to learn Kotlin :)

    • @i-am-learning-life
      @i-am-learning-life 4 роки тому

      Learn kotlin it's fun to code here

    • @zmemes69
      @zmemes69 4 роки тому +1

      @@i-am-learning-life Hi again hahaah i learned Kotlin

    • @i-am-learning-life
      @i-am-learning-life 4 роки тому +1

      @@zmemes69 happy to hear that

  • @MohanA-nz7cu
    @MohanA-nz7cu 4 місяці тому

    Server key not shown after
    If you are an existing user of the legacy HTTP or XMPP APIs (deprecated on 6/20/2023), you must migrate to the latest Firebase Cloud Messaging API (HTTP v1) by 6/20/2024.
    Need help .

  • @guy1407
    @guy1407 4 роки тому

    many many thanks!!!

  • @Night_man2014
    @Night_man2014 4 роки тому

    Amazing, thank you!
    If possible, an explanation in the language java

  • @mehulbisht9708
    @mehulbisht9708 4 роки тому

    haven't watched yet but does it work for Android Oreo and above which requires those notification channels ? if it does, then this is something i waited for so long !! and even if it doesn't, thanks for sharing the content and please try to make another one for handling notification channels ! thanks in advance to you mate !

    • @PhilippLackner
      @PhilippLackner  4 роки тому +1

      yes of course, I wouldn't make a video about something that doesn't work below Android for >Oreo. In my android fundamentals series I have a video about notifications and I also use channels there

  • @kannanramakrishnan3052
    @kannanramakrishnan3052 2 роки тому

    thank you

  • @sacmaliyoruz
    @sacmaliyoruz 3 роки тому

    thanks for video. how can we do this using java ?

  • @rustamsobirov8898
    @rustamsobirov8898 4 роки тому

    thanks this is so helpful video for me

  • @kabirubashirbin3622
    @kabirubashirbin3622 3 роки тому

    FCM messages are not received if the app is close .... don't know what am doing wrong or if there is a work around please .....thank in anticipation

  • @TinaHolly
    @TinaHolly 4 роки тому

    Amazing, thank you! 🙏

  • @meetgurl
    @meetgurl 4 роки тому +1

    i have tried exactly with your code but still not able to send the notification to specific device. so sad.

  • @jairrab
    @jairrab 4 роки тому +3

    Is it secure to place the server key on the client app? I am wondering if this can be exploited.

    • @PhilippLackner
      @PhilippLackner  4 роки тому +2

      Well, theoretically every single information you put in an app can be reverse engineered. But usually, this is very hard to do, especially if it is not contained in the source code. If you store the server key on your server then the attacker could as well find out your server details from your source code and get the server key from there. There is no 100% protection against this

    • @thcheung
      @thcheung 4 роки тому +1

      AndroidDevs Putting the key on client is absolutely different from hacking the server details . You are exposing the key to client. When client is pushing notifications, it makes requests with your key to firebase api. This means that the key can be easily found by monitoring requests made by client (like developer tools in chrome).
      Your server key must not expose to public. All notifications push must be done on server side, for example: firebase cloud function. See: stackoverflow.com/questions/37435750/how-to-send-device-to-device-messages-using-firebase-cloud-messaging

  • @learnuntildie631
    @learnuntildie631 3 роки тому +1

    Why I am getting StackOverflowError: stack size 1043KB error? I only did the first part of it.

    • @learnuntildie631
      @learnuntildie631 3 роки тому

      Found that the line of code Log.d("TAG", "Response ${Gson().toJson(response)}") causes error in devices that runs on Android 11. After removing it, app doesn't crashes anymore.

  • @AshooOffice
    @AshooOffice 2 роки тому

    How to set High priority while app in background?

  • @madguy1967
    @madguy1967 4 роки тому +1

    Bro but it is not working when I try to send from Firebase Cloud Messaging please tell me how could we receive data from the both sides !!

  • @feepin2058
    @feepin2058 4 роки тому

    Does the FireBaseService launch by itself ?

  • @angelamilosheska7537
    @angelamilosheska7537 3 роки тому +1

    Hi, I have a problem
    In sendNotification method it throws an exception saying Unable to create call adapter
    How should I solve this ?

    • @saimanidevi4873
      @saimanidevi4873 3 роки тому

      I ran into the same error. Not sure about the exact cause but after removing the Log statement that had - Response: ${Gson().toJson(response)} the error's gone. Hope this helps someone! :)

  • @thomasschwartzenburg7894
    @thomasschwartzenburg7894 2 роки тому

    Hi Philipp,
    Storing an API Key in plain text is a pretty risky move, especially if your Github repository is public. To work around this, I have stored my key in Firebase. However, when I retrieve this key I can't pass it in to the @Headers in the Notification API interface because my retrieval of the key is not in constant time. Do you have any suggestions on how to solve this problem? Thanks

  • @ShivamJha00
    @ShivamJha00 4 роки тому

    How do we localise the notifications according to user's preferred language

  • @fouedkasdallah4677
    @fouedkasdallah4677 2 роки тому

    Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @rihaworld9942
    @rihaworld9942 4 роки тому +1

    do you have video of java of this push notification

  • @mformobileapps
    @mformobileapps 3 роки тому

    Your channel is "the best" but everything in kotlin 😥😥

  • @riyazuddin515
    @riyazuddin515 4 роки тому

    Hey, can we schedule firebase notification or local notification

  • @binyamsintayehu5599
    @binyamsintayehu5599 3 роки тому

    I like it.

  • @riyazuddin515
    @riyazuddin515 4 роки тому +1

    🤩

  • @xero54bd3
    @xero54bd3 3 роки тому

    thanks a lot bro

  • @irkavladis85
    @irkavladis85 9 місяців тому

    you best

  • @sasee-9977
    @sasee-9977 7 місяців тому

    Broo How i know the recipient token without copy and paste?

  • @ibrahimelmansouri9434
    @ibrahimelmansouri9434 3 роки тому

    Hi thanks for tutorial i create function to send notification when app is enter doze after 1 min from sleep notification not recieved do you know how to fix this

  • @bandararo285
    @bandararo285 2 роки тому

    can i disble delete notification when app is in background

  • @kishorramani007
    @kishorramani007 3 роки тому

    How to add notification badge count in app's launcher icon?

  • @boostmytoolyoutube9340
    @boostmytoolyoutube9340 2 роки тому

    I advice you to simplify the source code as much as you can. I find that you explains a lot of things together. but you should know this rule: teaches ill, who teaches all

  • @brusooo
    @brusooo 2 роки тому

    I did the same code. I am receiving status code of 200 in response but not receiving any notifications. It's working fine when I push notifications from firebase console. Do you have any idea what might be wrong?

  • @gregfrllo
    @gregfrllo 4 роки тому +2

    Been waiting this for so looooong. Jk only aweek.

    • @PhilippLackner
      @PhilippLackner  4 роки тому

      Hope you like it 😁

    • @gregfrllo
      @gregfrllo 4 роки тому

      AndroidDevs I’m sure i will, will you make TDD vids? There’s can’t find people make it in utube

    • @PhilippLackner
      @PhilippLackner  4 роки тому

      Yea I know it's important, but so few people are actually interested in it, it's sad

    • @gregfrllo
      @gregfrllo 4 роки тому

      AndroidDevs hahaha

  • @johntotetwoo
    @johntotetwoo 4 роки тому +1

    Hi Philipp! Thanks again for this video. I do however have a silly question. (Disclamer: I have just watched this and have not tested yet on my end). At this point, ua-cam.com/video/HoFWPPv1ih8/v-deo.html, you have already changed line 38 to send to the recipient token instead of TOPIC. The question is, since at line 29 is not yet modified to recipientToken, how come the other device is already receiving the notification when it is still subscribing to TOPIC?

    • @PhilippLackner
      @PhilippLackner  4 роки тому +1

      Because the device knows its own token, so every message that goes to that token will be displayed. The topic doesn't change anything here, since we don't send a notification to it

  • @learnuntildie631
    @learnuntildie631 3 роки тому

    I have a weird issue, notifications received by devices that has opened the activity that is used to send the notification only. other devices does not receive the notification. What is the issue and how to fix it?

  • @nilkantkamble3739
    @nilkantkamble3739 2 роки тому

    does this work in flutter as well?

  • @XxXTHETTAAKKEERRXxX
    @XxXTHETTAAKKEERRXxX 3 роки тому

    buen video solo que en la parte de notificationApi agreguen un / antes de fcm/send min 8:39 line 14

  • @a.chillstechnologies9952
    @a.chillstechnologies9952 3 роки тому

    can you do that of flutter

  • @mohammadzahdeh04
    @mohammadzahdeh04 4 роки тому +1

    Can you make the same thing using the java?

  • @resevoirz
    @resevoirz 4 роки тому

    how if i want to send the notif to two person in the same time?

  • @Motivation-short786b
    @Motivation-short786b 4 роки тому +2

    I need code in java plz help me

  • @copybuzz5642
    @copybuzz5642 4 роки тому

    When I generate APK file and install real device it's not working but it's working file in debug mode. NB: I am adding release key in firebase app config. getting error 400. How can I solve this? Thank you

  • @thevictor7851
    @thevictor7851 2 роки тому

    I tried this, and for some reason it seems to be out of date :( please make an updated version?

  • @AandtheC2
    @AandtheC2 4 роки тому

    Will this work if converted into Java Script?