Home

Push Message

Push Message#

Push enables developers to send messages from servers or the cloud to mobile devices reliably and efficiently. Using push, notification messages (messages that the system can display to users) and data messages (key-value pairs of data processed by the app) can be sent to mobile and web apps. Push supports various platforms including iOS, Android, and web applications.

Key features#

  • Various message sending: Can send various types of messages including notification messages and data messages.
  • Mass messaging: Capable of sending messages to millions of users simultaneously, enabling efficient message delivery for large-scale applications.
  • Support for various platforms: Can receive messages on various platforms, including iOS, Android, and web applications.
  • Advanced messaging options: Offers advanced features such as setting message priority, setting lifespan (lifetime), topic-based subscription, and conditional message sending.

How to use push (mobile)#

  1. Firebase Project Setup

    • Create a project in the Firebase Console.
    • Add your application (Android or iOS) to the created project.
    • Download the necessary Firebase configuration file (google-services.json or GoogleService-Info.plist) and add it to the Project Settings on the Nbase dashboard.
  2. Add FCM SDK

    • For Android, add the Firebase Messaging dependency to your build.gradle file.
    • For iOS, install the Firebase/Messaging pod using CocoaPods.
  3. Request Permission for Push Notifications (iOS)

    • For iOS apps, you must request permission from users to receive push notifications. This can be done using UNUserNotificationCenter.
  4. Device Token Registration and Message Receipt

    • When the app is installed and run, the FCM SDK generates a unique token for the app instance. This token can be registered with your server to send messages to specific devices.
    • Implement a listener in your application to receive messages.