Chapter 13. Third-Party Integration, Monetization, and Services

Android game development or any other smartphone game development is not complete without implementing background services. Background services help the game spread and perform to reach the next level.

The style of game development has changed a lot with time. New styles and monetization techniques have been introduced. New game services have been created to support these techniques. Many tech companies start their own services to create a new industry. Any work we do professionally is mainly to earn our living, and the gaming industry is not an exception. However, this industry is targeting entertainment, fun, and interactivity between a device and the user. Developers make money based on this. All the third-party integration and services help developers monetize the game, which directly or indirectly helps increase revenue.

Services can be any background support that is not game specific and can improve the experience of a game. Mostly, services use the Internet and device hardware and software programs. Mostly, a server-based service works with the application to provide the service.

We will have a detailed look at these aspects in this chapter through the following topics:

  • Google Play Services
  • Multiplayer implementation
  • Analytic tools
  • Android in-app purchase integration
  • Android in-game advertising
  • Monetization techniques
  • Planning the game revenue
  • User-acquisition techniques
  • Featuring Android games
  • Publishing Android games

Google Play Services

Google is currently the largest platform for Android applications. Moreover, Google is the owner of the Android OS. So, there can be no one better than Google to be the service provider for the Android platform.

Google Play Services is a background service for all Android devices to access all Google service product APIs. It was launched in 2012 to support Android development and take it to the next level.

The most used services in the Google Play Services package are:

  • Google Analytics
  • Google IAB
  • Google Leaderboard
  • Push notifications

Google Analytics

Google Analytics is a service to track each and every event in the game. This can reveal user behavior, user actions, the number of users playing per day, each user's playing time, and so on. So, no data can go unnoticed by the developer. This analytic data helps developers identify the critical sections in the game. With this help, the developer can improve the game for better experience.

Significance

It is not always possible to track down each and every issue in the game in the testing or play testing phase. When the game gets bigger, with a huge user base, then it is more likely that unknown issues will be exposed. Google Analytics helps in these fields, not only with the current behavior of the user, but with the game performance as well.

Integration tips

Google Analytics is mostly used to track game events. So, the tracking events must be decided very carefully. The triggering points must also be placed in a strategic way. The developer might not require all the events and behavior data. More tracking may be even harmful to the application, as there would be more data use and more processing in the game.

The developer should always prioritize events. Events should be tracked based on the game flow design. They should then be validated by user action.

From the monetization point of view, it should always be a priority to track when the user is hitting the pay wall or which section is being visited more. A simple advertisement in the most visited section may increase the application's revenue.

Best utilization

The best utilization of the Google Analytics tool is no different than any other Android application analytics tool. This tool is the best possible way to track user movement, and through the data the developer can easily predict the user's motive or intention with the game.

Google IAB

In the modern world of gaming, there are many methods to monetize the application. In-app billing is one of the most popular methods. Google Play Services comes with the Google In-App Billing tool. This tool is directly associated with Google Play Store.

Through this tool, the developer can design some purchasable contents inside the game. For users, it is very easy to purchase from the built-in store of the Android application.

The Google IAB model

Let's have a quick look at the three purchasable options in Google IAB. We will have a detailed look at them later in this chapter:

  • Consumable items
  • Non-consumable items
  • Subscriptions

Consumable items

Users can purchase this item multiple times from the store. Google does not keep track of these kinds of items. The most common example of this type of item is in-game virtual currency. Many games are designed around virtual currency, and most of the time, this factor is the backbone of game monetization.

Non-consumable items

They are basically one-time purchases for the user. Google always keeps track of these purchases made by a user for any application through Google IAB. Even when a user uninstalls the application and reinstalls it, it is possible to restore the non-consumable purchases to the user's account.

The most common item under this category is game modes. In many games, there are some open modes and some can be purchased. This system also works with the try-and-buy monetization aspect.

Subscriptions

Subscriptions are basically a time-based model of monetization. This is mainly used in typical service-based applications such as music channels, TV channels, library channels, and so on. Very few games, however, use subscriptions to monetize.

Integrating Google IAB

Google Play Services comes with IAB APIs. The developer needs to register the application on Google Play Store to get live access. This system works with item IDs, which are called SKUs. Each SKU represents an item in the Play Store. The developer may not use all the SKUs created in the Google Play account for a particular game.

Advantages and disadvantages of Google IAB

We have already noted that Google IAB provides a platform to implement a direct digital purchasing system within the application. This saves great effort and time for both developers and consumers. Let's have a quick look at the advantages of Google IAB:

  • Google IAB provides a direct platform to purchase application components or services within the application
  • Google IAB simplifies the monetization aspect of an application
  • Google IAB provides multiple options for payment for consumer convenience
  • Google IAB stores and manages purchases for non-consumable items
  • There is hassle-free implementation and excellent customer support for Google IAB
  • The easy refund process is completely managed by Google IAB

So far, Google IAB has proved to be an excellent system for both developers and consumers or users. However, there are several sectors where Google IAB is still lagging behind. Now, let's have look at the sectors where Google IAB needs to improve:

  • Google IAB only provides billing services through Google Play Services
  • Google IAB still does not support carrier billing
  • Not every user is willing to provide credit card information to Google

Despite these issues, Google IAB is still the most popular platform for billing for Android developers. Google has started including carrier billing services within Google IAB, which may prove to be the most significant feature.

Google Leaderboard

Leaderboard is a platform for games and similar competitive applications where each and every user can track their progress among other users. Leaderboard has proved to be the driving force of many games. Google Play Services comes with an in-built Leaderboard system for Android applications.

Significance

Having a leaderboard integrated in games is always a plus, as it helps users compete with each other even when the game is not multiplayer. It is human psychology to try to become superior to others. Using this feature, there can be more user engagement than usual. However, the competing criteria on the leaderboard must be chosen carefully.

A good example of a leaderboard-driven game is Candy Crush. Users are very active, playing the simple game to stay ahead of their friends on the leaderboard.

Integrating Google Leaderboard

There is no separate Google Leaderboard package. This can be included by integrating Google Play Services itself. However, Leaderboard has to be set up in the Google games account to use it.

The developer can choose any parameter or calculation to store leaderboard data. Google Leaderboard supports data from multiple leaderboards for a single game. Most of the developers use this feature efficiently to show different leader lists, depending on the time period, region, or some other customized parameter.

Variety of leaderboards

Primary variations of Google Leaderboard are of two types:

  • Social Leaderboard
  • Public Leaderboard

Social Leaderboard

Social Leaderboard lists only players who are connected with the player's circle. For this feature, the player must log in to their respective Google accounts. This has a limitation to players who have played and choose to share their activity in the same application.

Public Leaderboard

Public Leaderboard stores data for players who choose to post scores publicly. Otherwise, this data won't be shown by Google Leaderboard, even if they have better score than the existing players on the public Leaderboard.

Options for storing and displaying leaderboards

Leaderboard storage can be classified into two types, based on ascending and descending order. In terms of Google Leaderboard, they are called:

  • Larger is better
  • Smaller is better

A score is always a numeric value, which is again classified into three formats:

  • Numeric value format
  • Time format
  • Currency format

In the case of a numeric value, the developer can specify the decimal placement. In the case of the time format, the developer needs to pass the score in milliseconds, and it will be automatically interpreted in the hh:mm:ss format. In the case of the currency format, the developer needs to specify the currency and its unit value beforehand. The Leaderboard will only take values in a unit and convert it to the specified unit format.

Leaderboard can have unique icons to display or indicate a unique leaderboard.

Push notifications

The push notification service can be achieved through the Google Cloud Messaging (GCM) service. Let's have a quick look at the cloud messaging architecture.

There are primarily four components used to implement push notifications for Android using GCM:

  • Database
  • Server
  • Target device
  • GCM service

Database

The database stores the registration details of a client or target device with the GCM service. So, each device is required to register only once. The same details are used to send push notifications to the registered target devices.

Server

Developers need to put up a server to achieve and control push notifications.

Target device

A target or client device is the platform where the message is pushed from the GCM. Each target device has a unique registration ID through the GCM. Without registration, a target device cannot receive any notifications.

GCM service

The GCM service is responsible for registering devices and pushing messages to them. The server requests the GCM service with a list of registration IDs and customized messages. GCM is only responsible for pushing the given content to specified devices:

GCM service

Workflow of the push notification system using GCM

Now, let's discuss the push notification workflow. In the preceding diagram, the push notification system works according to the indicated indexes (for example, a, b, c, and so on):

  1. a: The client or target device requests GCM to register with the application ID and sender ID.
  2. b: GCM sends the registration ID back to the sender after a successful registration.
  3. c: The device sends the registration ID to the developer's server.
  4. d: The server stores the registration ID to the database.
  5. e: The developer initiates the process to the push notification with customized content.
  6. f: The server fetches the registration ID list from the database.
  7. g: The database provides all the registration IDs.
  8. h: The server requests GCM with developer-specified content and registration IDs.
  9. i: GCM pushes the same content to the respective target devices according to their registration IDs.

Integrating push notifications

Integrating push notifications is done in three steps:

  1. Application integration
  2. GCM setup
  3. Server setup

Application integration

The developer needs to set up a GCM client for the application, which is the medium of GCM communication. Here is a brief about client-side development for GCM communication services.

It requires a set of manifest permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />

The manifest will also require declaration of the GCM receiver and GCM service:

<receiver android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRAION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.gcm" />
      </intent-filter>
</receiver>
<service android:name=".GcmService" android:exported="false">
      <intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
      </intent-filter>
</service>

Let's have a look at the registration process for an application with GCM. Registration can be done in many ways, depending on the development style. We will follow the simplest processes within the main Android activity and store the registration ID for one-time registration of the application.

Here are the required declarations:

private final Context testContext = this;
private final String SENDER_ID = "<Application ID from Google developer console>";
private final String SHARED_PREF = "com.test.gcmclient_preferences";
private final String GCM_TOKEN = "testgcmtoken";

The registration code should be put inside onCreate():

SharedPreferences appPrefs = testContext.getSharedPreferences(SHARED_PREF, Context.MODE_PRIVATE);
String token = appPrefs.getString(GCM_TOKEN, "");
if (token.isEmpty()) 
{
  try 
  {
    InstanceID instanceID =  InstanceID.getInstance(testContext);
    token = instanceID.getToken(SENDER_ID,  GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
    if (token != null && !token.isEmpty()) 
    {
      SharedPreferences.Editor prefsEditor = appPrefs.edit();
      prefsEditor.putString(GCM_TOKEN, token);
      prefsEditor.apply();
    }
  }
  catch (Exception e) 
  {
    e.printStackTrace();
  }
}

Now, let's define GCMService.java to handle the GCM message:

public class GcmService extends GcmListenerService 
{
  @Override
  public void onMessageReceived(String from, Bundle data) 
  {
    JSONObject jsonObject = new JSONObject();
    Set<String> keys = data.keySet();
    for (String key : keys) 
    {
      try 
      {
        jsonObject.put(key, data.get(key));
      } 
      catch (JSONException e) 
      {
        e.printStackTrace();
      }
    }
    try 
    {
      sendNotification("Received: " + jsonObject.toString(5));
    } 
    catch (JSONException e) 
    {
      e.printStackTrace();
    }
  }

  @Override
  public void onDeletedMessages() 
  {
    Log.d("Message is deleted …");
  }

  @Override
  public void onMessageSent(String msgId) 
  {
    Log.d("Message is sent …" + msgId);
  }

  @Override
  public void onSendError(String msgId, String error) 
  {
    Log.d("Sending Error … Msg" + msgId);
    Log.d("Error …" + error);
  }
  private void sendNotification(final String msg) 
  {
    Log.d("Sending Msg …" + msg);
  }
}

GCM setup

Google Play Services comes with a GCM system. GCM has to be enabled from the Google API console. Each registered application has its own unique application ID, which is required to configure the push notification system.

Here are the steps to enable GCM for the Android project:

  1. Create a project on the Google Cloud platform.
  2. Use the Google API to generate an API key.
  3. Create a server key for Android.
  4. Enable GCM for the application.

Server setup

Notification server development can be implemented by any cloud connection server technology. The developer needs to set up the application server by satisfying the following criteria:

  • The application server should be able to communicate with the application
  • The application server should be able to send properly formatted requests to the GCM connection server
  • The application server should be able to handle application requests and resend them using exponential backoff
  • The application server should be able to store the API key and client registration tokens in a secured database

Significance of push notifications

Push notifications are an inevitable part of modern day game development. Push notifications are used for the following reasons:

  • User retention
  • User control
  • Knowing user behavior
  • Alternative communication channel

User retention

Push notifications provide users with current updates and information on the game. There are many cases where the user downloads a game and then forgets about it. Sometimes, users leave games in between. Push notifications help these users regain interest in the game. This procedure improves user retention.

User control

Through device settings and the notifications center, the developer can control the content that the user will see, and the user can be navigated accordingly.

Knowing user behavior

Using user controls, the developer can track user behavior upon notifications. Depending on the user actions, the developer gets to know what the user likes and dislikes.

Alternative communication channel

There are several ways to communicate with end users. Mostly, users do not often communicate with the developer. So, a one-way communication channel proves to be fruitful. A push notification system fits the role perfectly. It is the best possible medium to deliver messages about the latest news, updates of the game, offers, and features. In some design models, it can be used to deliver game status information to users.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.46.92