0% found this document useful (0 votes)
96 views8 pages

Full N Final Report

This document discusses Firebase Cloud Messaging (FCM), which allows sending messages between a client app and an app server. FCM supports two types of messages - notification messages, which display a notification, and data messages, which are handled by the client app. Notification messages have limits on size and predefined keys, while data messages can contain custom key-value pairs up to 4KB. The document provides examples of JSON formatted messages for both notification and data types.

Uploaded by

Renuka Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views8 pages

Full N Final Report

This document discusses Firebase Cloud Messaging (FCM), which allows sending messages between a client app and an app server. FCM supports two types of messages - notification messages, which display a notification, and data messages, which are handled by the client app. Notification messages have limits on size and predefined keys, while data messages can contain custom key-value pairs up to 4KB. The document provides examples of JSON formatted messages for both notification and data types.

Uploaded by

Renuka Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

FIREBASE CLOUD MESSAGING

Dinesh Kumar Tiwari Ayushi Shukla Neha Srivastava Uma Shree


Assistant Professor CSE, FGIET CSE, FGIET CSE, FGIET
CSE, FGIET Raebareli , India Raebareli , India Raebareli , India
Raebareli , India [email protected] [email protected] [email protected]
[email protected] m om m
Abstract – In this paper we will be introducing this firebase android tutorial we will do a very
FIREBASE ,which is a realtime database that simple example of using firebase for our android
can communicate directly from the client. When application. Obviously it takes more than client
we save our JSON data to Firebase, changes are side code to build a true web app. You’ll need a
sent instantly to all clients, web and mobile, that backend that handles a database, authentication,
requested them. With built-in static file hosting, ajax, an accessible api, and you'll need somewhere
user management, and security rules, Firebase to host that backend. There are many things that
will help us build modern applications faster make backend development easier like Ruby on
than ever. Firebase covers all that mobile Rails, or services like Heroku but there is still a lot
developers need to build, maintain and scale a of development time that goes into building these.
mobile app on all platforms (even on iOS): from Firebase takes care of most of the backend
Storage and databases to innovative tools concerns and is dubbed a Backend as a Service
like Remote Config and TestLab. FCM inherits (BaaS).
GCM’s core infrastructure but simplifies the
client development. Developers no longer needs to Firebase is also a realtime api utilizing web
write their own registration or subscription retry sockets for pushing state to your application. This
logic. Now, we can integrate FCM in our app means that an interactive app can be even more
with just a few lines of code. Plus, FCM includes interactive as you don’t need to refresh the
a web console called Firebase Notifications. browser to get updates; they are pushed in real-
However, GCM is not deprecated: Google will time.
continue to support it but allnew client-side
features will be available on FCM SDK only. The FIREBASE CLOUD MESSAGING
protocol remains the same server-side though.
How FCM works?
NOMENCLATURE
FCM-Firebase Cloud Messaging Firebase Cloud Messaging (FCM) is a cross-
GCM-Google Cloud Messaging platform messaging solution that lets you reliably
deliver messages at no cost.Using FCM, you can
SDK-Software Devolopment Kit notify a client app that new email or other data is
available to sync. You can send notification
messages to drive user reengagement and
1.INTRODUCTION retention. For use cases such as instant messaging,
a message can transfer a payload of up to 4KB to a
Firebase is a platform for building mobile and web
application. You can build application quickly
with real time data update. Using firebase is very
easy and it stores data in JSON format. You do not
need to configure your server when you use
firebase. Every thing will be handled by firebase
automatically. So no coding on server side. It will
save time and will make you more productive. In
client app. implementation. For the full list of message
options, see the reference information for your
chosen connection server
protocol, HTTP orXMPP.

Message types

With FCM, you can send two types of messages to


clients:

Notification messages, sometimes thought of as


"display messages."
Data messages, which are handled by the client
app.

A notification message is the more lightweight


option, with a 2KB limit and a predefined set of
An FCM implementation includes an app server user-visible keys. Data messages let developers
that interacts with FCM via HTTP or XMPP send up to 4KB of custom key-value pairs.
protocol, and a client app. You can compose and Notification messages can contain an optional data
send messages using the app server or payload, which is delivered when users tap on the
the notification console. notification.

Firebase Notifications is built on Firebase Cloud Use notification messages when you want FCM to
Messaging and shares the same FCM SDK for handle displaying a notification on your client
client development. For testing or for sending app's behalf. Use data messages when you want to
marketing or engagement messages with powerful process the messages on your client app.
built-in targeting and analytics, you can use
Notifications. For deployments with more complex The app server can send a message including both
messaging requirements, FCM is the right choice. notification and data payloads. In such cases, FCM
handles displaying the notification payload, and
the client app handles the data payload.
ABOUT FCM MESSAGES
Note: If you want to send messages consisting of
only custom key-values to an iOS device when the
Firebase Cloud Messaging (FCM) offers a broad
app is in the background, set custom key-value
range of messaging options and capabilities. The
pairs in the data key and
information in this page is intended to help you
set content_available to true.
understand notification messages and data
messages and what you can do with them using Notification messages provide an easy way for
FCM's options. developers to send a user-visible display message
with some predefined keys and optional custom
Some of these options are available only through
key-value pairs. Data payloads include the
the Firebase Cloud Messaging server
developer's custom key-value pairs only, and the
client app must handle the message. You can send For example, here is a JSON-formatted message in
messages that have both notification and data the same IM app as above, where the information
payloads. is encapsulated in the data key and the client app is
expected to interpret the content:

{
Notification messages
"to" :
To send notification messages, set "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMEx
the notification key with the necessary predefined UdFQ3P1...",
set of key options for the user-visible part of the "data" : {
notification message. For example, here is a "Nick" : "Mario",
JSON-formatted notification message in an IM "body" : "great match!",
app. The user can expect to see a message with the "Room" : "PortugalVSDenmark"
title "Portugal vs. Denmark" and text "great },
match!" on the device: }

On iOS, FCM stores the message and delivers it


{
only when the app is in the foreground and has
"to" : established a FCM connection. On Android, a
"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZv client app receives a data message
vDMExUdFQ3P1...", in onMessageReceived() and can handle the key-
"notification" : { value pairs accordingly.
"body" : "great match!",
"title" : "Portugal vs. Note these further platform-specific details:
Denmark",
"icon" : "myicon" A. On Android, the data payload can be
}
retrieved in the Intent used to launch your
activity.
}
B. On iOS, the data payload is found
Notification messages are delivered to the in didReceiveRemoteNotification:.
notification tray when the app is in the
background. For apps in the foreground, messages Features
are handled by these callbacks:

 didReceiveRemoteNotification: on iOS
 onMessageReceived() on Android.
The notification key in the data bundle contains
the notification.

Data messages
Set the data key with your custom key-value pairs
to send a data payload to the client app. Data
messages can have a 4KB maximum payload.
Real time database When a user authenticates to a Firebase app, three
things happen:
Store and sync data with our NoSQL cloud
database. Data is synced across all clients in  Information about the user is returned in
realtime, and remains available when your app callbacks on the client device. This
goes offline.The Firebase Realtime Database is a allows you to customize your app's user
cloud-hosted database. Data is stored as JSON and experience for that specific user.
synchronized in realtime to every connected client.
When you build cross-platform apps with our iOS,  The user information returned contains
Android, and JavaScript SDKs, all of your clients a uid (a unique ID), which is guaranteed
share one Realtime Database instance and to be distinct across all providers, and to
automatically receive updates with the newest never change for a specific authenticated
data.The Realtime Database provides a flexible, user.
expression-based rules language, called Firebase  The value of the auth variable in your
Realtime Database Security Rules, to define how app's Security and firebase
your data should be structured and when data can rules. becomes defined. This variable
be read from or written to. When integrated with isnull for unauthenticated users, but for
Firebase Authentication, developers can define authenticated users it is an object
who has access to what data, and how they can containing the user's unique (auth.uid)
access it. and potentially other data about the user.
This allows you to securely control data
access on a per-user basis.

Cloud messaging

Authentication

Most applications need to know the identity of a


user. Knowing a user's identity allows an app to
provide a customized experience and grant them
permissions to access their data. The process of
proving a user's identity is called authentication.
Firebase provides a full set of authentication
options out-of-the-box.
Storage
Firebase Storage is built for app developers who
need to store and serve user-generated content,
such as photos or videos.Firebase Storage
provides secure file uploads and downloads for
your Firebase apps, regardless of network quality.
You can use it to store images, audio, video, or
other user-generated content. Firebase Storage is
backed by Google Cloud Storage, a powerful,
simple, and cost-effective object storage service.

Test Lab
Test in the lab, not on your users

 Generate detailed reports and screenshots


to help identify bugs

 Run custom test scripts on hundreds of


device configurations

 Supplement your existing workflow


Hosting through integration with Android Studio,
Firebase Hosting provides fast and secure static command-line tools, and Web-based
hosting for your web app.Firebase Hosting is consoles
production-grade web content hosting for
developers. With Hosting, you can quickly and
easily deploy web apps and static content to a Crash Reporting
global content-delivery network (CDN) with a
single command.

Remote Config:
Remote Config is a cloud service that lets you
change the behavior and appearance of your app
without requiring users to download an app
Crash Reporting creates detailed reports of the
update. When using Remote Config, you create in-
errors in your app. Errors are grouped into clusters
app default values that control the behavior and
of similar stack traces and triaged by the severity
appearance of your app. Then, you can later use
of impact on your users. In addition to automatic
the Firebase console to override in-app default
reports, you can log custom events to help capture
values for all app users or for segments of your
the steps leading up to a crash.
userbase.
CONCLUSION AND FUTURE
SCOPE
Firebase isn't just a backend as a service anymore.
References
It's THE developer backend to use for Google Web references
services.It can't be understated how important this
shift is for Google and for Firebase. They provided 1)https://firebase.google.com/docs
a simple and unified platform with so many of the
best Google features packed in.When creating our 2) https://scotch.io/bar-talk/a-look-at-the-
apps, we as developers need to go and grab a
bunch of different services to create what we want.
new-firebase-a-powerful-google-platform
Here are the things that can now be replaced when
creating our apps:
 Google Analytics (built into
Firebase for free)

 Site Hosting (any hosting)

 Global CDN (Cloudflare, CloudFront, or


MaxCDN)

 Storage (S3)

 AdSense for ads (built into Firebase)

 Cloud/Realtime Messaging/Notifications
(Pusher)

 More

All of the above can now be implemented when


using Firebase. One platform for all of that
goodness. That's a lot of time saved so that we can
focus on the actual things that make our apps/sites
unique.Firebase jumped from 100,000 users when
it was acquired in October 2014 to 450,000+ this
month. With this set of mobile centric features, I
can only imagine how much larger their userbase
will grow. Very exciting stuff for the great team
over there.

You might also like