LogoLogo
  • A better way to do...stuff!
  • How we build the app
    • Overview
  • Documentation
    • Draftbit
      • Using Live Preview
      • Workspaces and Billing
      • Introduction to the Builder
      • Layout
      • Intro to Navigation
      • Fetching Data
      • Direct Integrations
      • FAQs
      • Draftbit
      • Draftbit
      • Custom Blocks
      • Borders, Background, and Elevation
      • Actions
      • Custom Screen Code
      • Exporting and Publishing Your Project
      • Sharing Your Project Online
      • Publishing Your App as a PWA
      • Stack Navigator
      • Tab Navigator
      • Draftbit
      • Draftbit
      • Basic
      • Media
      • REST Services & Endpoints
      • REST API Integrations
      • Themes & Styling
      • Submitting Data
      • Draftbit
      • Draftbit
    • Xano
      • resources-and-tips-1
        • 🎞️ Xano Video Tutorials
        • 🤝Community Corner
        • 💰Share Xano. Make money
      • FAQ
      • getting-started
        • ⚡ Jumpstart
        • 🎞️ The Xano Interface
      • instances
        • What is an Instance?
        • Early Access Instance
        • Upgrading an Instance
        • Sharing
        • Bandwidth Usage
        • API Rate Limit
      • What is a Workspace?
      • Dashboard
      • Database
      • Airtable Import
      • API
      • Library
      • Marketplace
      • Settings
      • authentication
        • Authentication
        • Sign-up & Log in
      • data-manipulation
        • The Function Stack
        • Addons (GraphQL-Like)
        • The Expression Builder
        • External Query Manipulation
        • Timestamp
        • Filters
        • Images
    • Expo
      • Creating your first build - Expo Documentation
    • Kommunicate
      • Installation
      • Installation
      • Installation
      • Installation
      • Installation
      • Flutter Installation
      • Installation
      • Zapier Integration
      • Authentication
      • CMS Installation
      • Authentication
      • Conversation
      • Conversation Assignment
      • Customization
      • Localization
      • Logout
      • Web Troubleshooting
      • Installation
      • Authentication
      • Push Notification
      • Conversation
      • Customization
      • Localization
      • Logout
      • Installation
      • Authentication
      • Push Notification
      • Conversation
      • Customization
    • Formito
      • basics
        • Getting Started
        • Variables
        • Are you GDPR ready?
        • How to prefill the values of my chatbot?
      • connect
        • How to connect Formito to Zapier?
      • convert
        • How to convert old formito chatbots to the new version?
        • How to convert Google Forms into a chatbot?
        • How to convert a Monday.com board to a chatbot?
        • How to create chatbot from QuickBase table?
      • guide
        • How to add my chatbot to WordPress?
        • How to create a chatbot for Zendesk?
      • shopify
        • How to embed my chatbot into a Shopify page?
        • How to display Formito chatbot on bottom corner of my Shopify store?
        • How to open my chatbot after clicking on links or buttons?
    • Stonly
  • Flex Stuff
    • App
    • APIs
    • Database
    • Website
    • Design
    • Style Guide
  • Content
    • Guides
    • ChatBots
    • Blogs
    • Whitepapers
  • Company
    • About us
    • Brand
    • Roadmap
    • Policies
  • Flex Together
    • Overview
    • Fair Finance
Powered by GitBook
On this page
  • Overview
  • 1) Get the google-services.json file
  • 2) Obtain server key from firebase
  • 3) Add your server key to Kommunicate
  • 4) Gradle file configuration
  • Already have the push notification setup?
  • 1) Send the device token to Kommunicate
  • 2) Receive push notifications
  • Set notification small icon

Was this helpful?

  1. Documentation
  2. Kommunicate

Push Notification

PreviousAuthenticationNextConversation

Last updated 4 years ago

Was this helpful?

Overview

You can set up push notifications to notify your end users for incoming chat messages. For managing push notifications, you must have a .

Note: If you already have a Firebase account and code to retrieve firebase registration token for the client app instance, then skip this section and move to section.

1) Get the google-services.json file

  1. If you haven't already added firebase to your project, add

  2. Once you're done with above setup, download the google-services.json file from firebase console, click Settings icon -> Project settings -> General -> Scroll to bottom -> Select your app -> Click the google-services.json button.

  3. Place the google-services.json file under the root directory of your app.

2) Obtain server key from firebase

  1. From firebase console, click Settings icon -> Project settings

  2. Once you clicked project settings select Cloud Messaging tab under Settings. Under Project Credentials, copy your Server Key which is highlighted blue in the following image.

Note: Make sure you copy the Server key and not the Legacy key or Sender ID.

3) Add your server key to Kommunicate

Go to in Kommunicate dashboard and update the FCM server key under the 'GCM/FCM Key' section. You can find it in the Settings -> Cloud Messaging -> Server Key section of your Firebase console.

4) Gradle file configuration

  1. Open your project level(root level) build.gradle file and under buildscript node, add the below classpath inside dependencies:

 classpath 'com.google.gms:google-services:3.1.1'
  1. Open your app level build.gradle and at the bottom of the file apply the plugin as below:

apply plugin: 'com.google.gms.google-services'

If you do not have any push notification setup, kommunicate will do it internally for you. If you already have the setup, follow the next section.

Already have the push notification setup?

If you already have the push notification setup, follow the below steps.

1) Send the device token to Kommunicate

The first step in the setup would be to send the deviceToken to Kommunicate. This needs to be done in onNewToken method of your FirebaseMessagingService subclass. The onNewToken method is called whenever firebase updates the deviceToken on that device.

Note: onNewToken method provides registrationId, this is the deviceToken.

Use the below code to send the token to Kommunicate.

Kommunicate.updateDeviceToken(context, registrationId);

2) Receive push notifications

For Receiving FCM Notifications in your app, add the following code in your FirebaseMessagingService inside onMessageReceived(RemoteMessage remoteMessage):

if (Kommunicate.isKmNotification(this, remoteMessage.getData())) {
    return;
}

Set notification small icon

To set the notification small icon, place the below metadata in your AndroidManifest.xml file under tag :

 <meta-data 
    android:name="com.applozic.mobicomkit.notification.smallIcon"
    android:resource="" /> 

Note: Android version 6.0 onwards, android automatcially converts the small icon color to monochrome. While some custom ROM devices do show colored icons, it is recommended that you use a shaped icon with some transparent background instead of round solid icons as a small icon.

Firebase account
Firebase to your Android project
Push notification section
Push notification setup