How to send Push Notification (cloud messaging) from Firebase console to your Android App?

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2020
  • This video shows simple steps to create an Android App and connect it with the Firebase project.
    Then it shows how one can use Firebase cloud messaging service to send the push notification on the phones which have this Android App installed.
    I hope you like this video. For any questions, suggestions or appreciation please contact us at: programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
    Complete source code and other details can be found in the below link:
    programmerworld.co/android/ho...
    However, the main Java code is copied below also for reference:
    package com.programmerworld.pushnotificationapp;
    import androidx.appcompat.app.AppCompatActivity;
    import android.content.Intent;
    import android.os.Bundle;
    import com.google.firebase.messaging.FirebaseMessaging;
    public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intentBackgroundService = new Intent(this, FirebasePushNotificationClass.class);
    startService(intentBackgroundService);
    }
    }
    package com.programmerworld.pushnotificationapp;
    import androidx.annotation.NonNull;
    import com.google.firebase.messaging.FirebaseMessagingService;
    import com.google.firebase.messaging.RemoteMessage;
    public class FirebasePushNotificationClass extends FirebaseMessagingService {
    public FirebasePushNotificationClass() {
    super();
    }
    @Override
    public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
    super.onMessageReceived(remoteMessage);
    }
    }

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

  • @User-yz5mr
    @User-yz5mr 2 ปีที่แล้ว +1

    Great job ! Bro you saved my time~~
    Thanks for code too

  • @user-pk1ng5xe4c
    @user-pk1ng5xe4c 3 ปีที่แล้ว +1

    u are BEST!

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

    Hero ⚘❤

  • @shahidwani6445
    @shahidwani6445 3 ปีที่แล้ว

    Sir how to subscribe all existing users to a topic using firebase console

  • @evelynimmanuel942
    @evelynimmanuel942 2 ปีที่แล้ว

    How to add deep linking for the notification?

    • @ProgrammerWorld
      @ProgrammerWorld  2 ปีที่แล้ว

      It depends on the server from which the notification is sent. However, embedding URLs in the text part of the message can be used to send links over notifications.
      For reference, the complete source code shown in this video is also shared in the below link:
      programmerworld.co/android/how-to-send-push-notification-cloud-messaging-from-firebase-console-to-your-android-app-complete-source-code/
      Cheers
      Programmer World
      programmerworld.co
      -

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

    the app is running but no notofication

    • @ProgrammerWorld
      @ProgrammerWorld  2 ปีที่แล้ว

      This is a bit tricky App. Build successful means that the App has successfully compiled and installed on your phone, device or emulator.
      However, to have it working, it is important that the App is able to listen to the server and has the connection established.
      As a quick start, I will suggest to ensure and check whether the json file is correctly placed. If not then please re-download the file and check again.
      Also, all the dependencies should be correctly implemented (including their correct versions) in the gradle file, for example:
      implementation platform('com.google.firebase:firebase-bom:26.2.0')
      implementation 'com.google.firebase:firebase-analytics'
      implementation 'com.google.firebase:firebase-messaging:21.0.0'
      I do not think there is any other quick approach to diagnose this issue.
      Please note, for reference the source code shown in this video is also available in the below link:
      programmerworld.co/android/how-to-send-push-notification-cloud-messaging-from-firebase-console-to-your-android-app-complete-source-code/
      Cheers
      Programmer World
      programmerworld.co/
      -

  • @akashkakkad1654
    @akashkakkad1654 2 ปีที่แล้ว

    Notifications not received although build is successful

    • @ProgrammerWorld
      @ProgrammerWorld  2 ปีที่แล้ว

      This is a bit tricky App. Build successful means that the App has successfully compiled and installed on your phone, device or emulator.
      However, to have it working, it is important that the App is able to listen to the server and has the connection established.
      As a quick start, I will suggest to ensure and check whether the json file is correctly placed. If not then please re-download the file and check again.
      Also, all the dependencies should be correctly implemented (including their correct versions) in the gradle file, for example:
      implementation platform('com.google.firebase:firebase-bom:26.2.0')
      implementation 'com.google.firebase:firebase-analytics'
      implementation 'com.google.firebase:firebase-messaging:21.0.0'
      I do not think there is any other quick approach to diagnose this issue.
      Please note, for reference the source code shown in this video is also available in the below link:
      programmerworld.co/android/how-to-send-push-notification-cloud-messaging-from-firebase-console-to-your-android-app-complete-source-code/
      Cheers
      Programmer World
      programmerworld.co/
      -

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

    Doesn't work it.

    • @ProgrammerWorld
      @ProgrammerWorld  3 ปีที่แล้ว

      What's the error/ exception it is throwing?
      Cheers
      Programmer World
      programmerworld.co
      -

  • @danielpliszka8220
    @danielpliszka8220 3 ปีที่แล้ว

    Where did you get the token

    • @ProgrammerWorld
      @ProgrammerWorld  3 ปีที่แล้ว

      I think all the steps are shown in the video. So, please check the steps shown in the video carefully. Let us know if still the issue is there.
      Cheers
      Programmer World
      programmerworld.co
      -

    • @danielpliszka8220
      @danielpliszka8220 3 ปีที่แล้ว

      @@ProgrammerWorld I'm still having an issue. Do you have a github repo where I can see the code?

    • @ProgrammerWorld
      @ProgrammerWorld  3 ปีที่แล้ว

      I think all the details along with the complete source code is shared on my website. It should help.
      Cheers
      Programmer World
      programmerworld.co
      -

  • @dhanashreetambe8153
    @dhanashreetambe8153 2 ปีที่แล้ว

    How to recieve notification when the app is killed.

    • @ProgrammerWorld
      @ProgrammerWorld  2 ปีที่แล้ว

      When the App is killed or is not running in your phone then also Push notification will be received because push notification works on OS level and not on individual App. The moment a notification is received by the Android OS it will display it.
      Let me know if you are observing any different behaviour.
      For reference, the complete source code shown in this tutorial is also shared in the below link:
      programmerworld.co/android/how-to-send-push-notification-cloud-messaging-from-firebase-console-to-your-android-app-complete-source-code/
      Cheers
      Programmer World
      programmerworld.co
      -

  • @anb4351
    @anb4351 3 ปีที่แล้ว

    not working

    • @ProgrammerWorld
      @ProgrammerWorld  3 ปีที่แล้ว

      Are you observing any error or exception is being thrown? Could you please share more details of the issue?
      For reference, complete source code of this video is shared in the below link as well:
      programmerworld.co/android/how-to-send-push-notification-cloud-messaging-from-firebase-console-to-your-android-app-complete-source-code/
      Cheers
      Programmer World
      programmerworld.co/
      -