Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Android Wear Projects

You're reading from  Android Wear Projects

Product type Book
Published in Jul 2017
Publisher Packt
ISBN-13 9781787123229
Pages 416 pages
Edition 1st Edition
Languages
Author (1):
Ashok Kumar S Ashok Kumar S
Profile icon Ashok Kumar S

Table of Contents (18) Chapters

Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
Getting You Ready to Fly - Setting Up Your Development Environment Let us Help Capture What is on Your Mind - WearRecyclerView and More Let us Help Capture What is on Your Mind - Saving Data and Customizing the UI Measure Your Wellness - Sensors Measuring Your Wellness and Syncing Collected Sensor Data Ways to Get Around Anywhere - WearMap and the GoogleAPIclient Ways to Get Around Anywhere - UI controls and More Let us Chat in a Smart Way - Messaging API and More Let us Chat in a Smart Way - Notifications and More Just a Face for Your Time - WatchFace and Services More About Wear 2.0

Chapter 9. Let us Chat in a Smart Way - Notifications and More

The previous chapter helped us in building a conversational messaging application, but the Wear app had a very normal user interface with no notifications whatsoever. Notification is a very important aspect of a messaging application, but it needs complex infrastructure to process the notification. When the sender sends a message to the receiver, the receiver should get a notification conveying certain information, such as the sender name, and a quick message preview.

Notification is a component in Android that we can use to display information. In the case of a messaging application, the receiver should get the push notification to instantiate the notification component. So, whenever there is a real-time database update in Firebase, both the handheld device and the Wear device should get the notification. Thankfully, we don't need a server to handle the notification; Firebase will handle push notifications for your messaging...

Firebase functions


Firebase functions are the solution for database triggers and many more server-related executions. Instead of hosting a server, which listens to Firebase database changes and then fires the notification, we shall utilize one of the Firebase technologies to complete this task. Firebase functions has an efficient control on all the Firebase technologies, such as Firebase authentication, storage, analytics, and so on. Firebase functions can be used in various aspects; for example, when your analytic cohorts meet some milestone, you can send targeted notifications, invites, and so on. Any server level business logic that you might want to implement in your Firebase system has been made with Firebase functions. We will use Firebase functions for sending push notifications whenever a database trigger occurs. We need an entry level JavaScript understanding to complete this task.

To get started on Firebase functions, we need Node.js environment that you can install it from https...

Summary


In this chapter, you have learned how to use Firebase functions to send push notifications and to use the notification component from the Wear support library. Notifications are integral components in smart devices; they play a crucial role by reminding users. We have understood the NotificationCompat.Builder class and the WearableExtender class. We have also explored the input method framework and the easiest way to reply with multiple reply mechanisms, such as emojis, voice support, and so on.

 

lock icon The rest of the chapter is locked
You have been reading a chapter from
Android Wear Projects
Published in: Jul 2017 Publisher: Packt ISBN-13: 9781787123229
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime}