Android

How To Create Your Own Sticker Pack for Google Keyboard (Demo)

Have you ever wondered how stickers are added to your Google Keyboard? I joined a meet-up event conducted by AndroidlistenerGroup in Chicago...

Written by Vortana Say · 3 min read

Have you ever wondered how stickers are added to your Google Keyboard? I joined a meet-up event conducted by AndroidlistenerGroup in Chicago last weekend and one of the topics provided an answer to the above question.

I hope this article could provide more explanations and basic grounds for anyone who is interested in creating their own sticker packs for Google Keyboard.

What is GBoard?

GBoard is a google keyboard that has everything you love about Google Keyboard — speed and reliability, Glide Typing, voice typing, and more — plus Google Search built in. No more app switching; just search and share, right from your keyboard.

Gboard also has emoji search to help you find emoji faster, plus GIF search, and multilingual typing to let you switch between languages on the fly.

As can be seen from the above, there is more than a million downloads of the keyboard. These are the market for your sticker packs.

  • Normal Keyboard vs GBoard

What is the sticker?

A sticker is a label or motion image that expresses one’s feelings. Those who use social network media are much familiar with stickers.

Here are stickers available for GBoard.

Firebase

  • Firebase Indexing

Firebase App Indexing gets your app into Google Search. If users have your app installed, they can launch your app and go directly to the content they’re searching for. App Indexing reengages your app users by helping them find both public and personal content right on their device, even offering query autocompletions to help them more quickly find what they need. If users don’t yet have your app, relevant queries trigger an install card for your app in Search results.

Using the Firebase App Indexing API, you’ll be able to index any sticker assets you created.

Now that you understand all the important components, here is how to create your sticker pack for GBoard

Prerequisites

  • A device running Android 4.0 (Ice Cream Sandwich) or newer, and Google Play Services 11.4.0 or higher
  • The Google Play Services SDK from the Google Repository, available in the Android SDK Manager
  • The latest version of Android Studio, version 1.5 or higher
  • Firebase index configuration
  • Google-services.json, a configuration from your Firebase project
  • Install Google Keyboard application

Get your hands dirty

In the demo code, I used JobIntentService for background service, and execute it when the user clicks on the add sticker button.

Then we can execute the service:

         AppIndexingUpdateService.enqueueWork(HomeActivity.this);

AppIndexingUtil.java is an util class that has useful methods for getting indexable builders of sticker packs and stickers.

Note:

  • You should build and index stickers on the first run after an update or install to minimize the lag between a user installing the app and seeing the stickers in GBoard.
  • Sticker guide for Google keyboard: For optimal image quality, use square images sized 320 pixels or 500 pixels.

Demo Run

Source Code:

https://github.com/vsay01/GboardCustomSticker

 

Encountered issue:

  • Error:org.gradle.api.GradleException: File google-services.json is missing. The Google Services Plugin cannot function without it.

You need to provide your google-service.json generated by your Firebase project.

 

  • Android App Indexing → FirebaseAppIndexingInvalidArgumentException Intent cannot be resolved;

In the activity manifest

<intent-filter>
 <action android:name=”android.intent.action.VIEW” />
 <category android:name=”android.intent.category.DEFAULT” /> 
 <category android:name=”android.intent.category.BROWSABLE” />
 <data android:scheme=”mystickers” /> //name of your schema
 <data android:host=”sticker” />
 </intent-filter>

Get Featured in the Sticker Collection

Deploy the app and submit to google for preview and let it available for all Board user.

For more information, here are the two official resources: