Android App
No part of this help can be reproduced, transmitted, copied, stored in a retrieval system without prior written permission from Emoji Games, nor can it be translated into any language using any form or means, electronic, mechanical, photocopying, recording, or otherwise.
All copyrights, confidential information, patents, design rights, and all other intellectual property rights contained herein are the sole and exclusive property of Emoji Games. The information provided herein is considered accurate and reliable.
Emoji Games is also not responsible for the use of the game or any third-party patent or other rights infringement resulting from it.
1. Introduction
1.1. Purpose
The purpose of this document is for developers who want to integrate games provided by Emoji Games into Android games/apps.
1.2. Preparation
Development tools on PC: Eclipse, Android SDK.
Operating system of mobile devices: Android 2.3 or higher.
event_info.dat file created in BMG Event Creator tool (provided by Emoji Games).
You need to upload the event_info.dat file to the server and obtain the direct URL of the file.
1.3. Overview
2. Configuration
2.1. Import event_info.dat file
For inquiries about the event_info.dat file, please contact support@brandedminigames.com.
2.2. Upload event_info.dat file to the server
After receiving the event_info.dat file, you need to upload it to the server and obtain the direct URL.
Example: http://brandedminigames.com/BMGSDK_Demo/event_info.dat
2.3. Update AndroidManifest.xml file
2.3.1. Add permissions
Access permissions are required to check information about internet connection and network status. Add this permission to the file.
Insert the following code into the "AndroidManifest.xml" of the project.
2.3.2. Update Activity Intent-filter
Add a new intent filter as below in the main activity of the application.
Don't forget the "singleTask" launchMode attribute. It will deliver the result to the correct activity.
Set the Scheme to the package name of the application.
The Scheme must be the same as the one registered on the campaign page of the Studio site.
2.3.3. Hardware acceleration
The performance of the Webview may be degraded when playing branded mini-game titles. To resolve this issue, you need to add one or more configurations to the app manifest.
3. Implementation
3.1. Download and decode event_info.dat file from the server
3.1.1. Download event data file
First, you need to have the URL of the dat file containing the branded mini-game event.
Example: http://brandedminigames.com/BMGSDK_Demo/event_info.dat
To use the game demo event for testing, set the URL to the URL above. This is the event information data file for the game demo event. Alternatively, you can download this event_info.dat file and upload it to your server. The URL will be your server URL.
In your main Activity, use this code in the onCreate(Bundle savedInstanceState) method to download the dat file data and store it in a byte array. You can improve performance using a Handler or AsyncTask.
3.1.2. Data decoding
When you receive the byte array from the data file on the server, it is not usable because it is encoded.
The algorithm is "AES-128".
The key is "brandedminigames".
Use this code to decode the data.
Now that you have the outputString and it is a pure JSON string, parse this string into a JSONArray, JSONObject.
Since you can create many events using the BMG Event Data Tool, the event information decoded from binary data to JSON data is an array list. You can select and use a specific event from the array list. In particular, it is a JSON array containing one or more JSON objects. If there are many events, you can store them using an ArrayList.
JSON object information:
Field name | Description |
---|---|
start | Event start time. Format ‘MM/dd/yyyy’ |
end | Event end time. Format ‘MM/dd/yyyy’ |
status | Event status.0: Disable1: Enable |
url | Event game url |
title | Event title |
desc | Event description |
maxScore | Maximum possible score from this event game |
campaignId | ID of current campaign |
3.2. Store event information in memory
When you receive the event data, it is a good idea to store it in memory for later use. Using a Java global list eliminates the need to retrieve event information from the server again.
3.3. Build URL from the original URL in memory
After retrieving and decoding data from the event_info.dat file, you need to build a URL based on the URL received in the previous step to play the branded mini-game.
(String url = jobj.optString(“url”)).
The new URL is as follows:
"app_user": This is a string format. It should be the email address or ID of the user obtained from the application after the user logs in. This information is used to identify each user who participated in the event mini-game and can become a winner through this parameter. It is detected at the end of the event. If the user is not logged in or does not have an account, you need to generate a random value. This parameter is required. Example: random value:
String userId = “Guest_” + UUID.randomUUID().toString().substring(0, 8);
3.4. Play the game
3.4.1. Play the game in an external browser
You can use the following code to call the browser to play the branded mini-game with the URI above.
When the game is finished, it will go to the Leaderboard. You can return to the app by clicking the complete button, as the href of the complete button on that page is an Android schema.
3.4.2. Play the game in WebView
If you don't want to use an external browser, you can define a unique activity containing only WebView to play the branded mini-game.
Of course, you still need to build the URL to play, similar to "3.3 Build URL from the original URL in memory."
You can implement the BMGWebView activity in the code as follows:
Now, after building the URL, use the following code to call the BMGWebView.
3.5. Get game results
Using WebView, you can get game results in the WebViewClient implementation within BMGWebView.
If you are using an external browser, you need to implement a new method in the main activity.
Result data:
Field name | Description |
---|---|
rank | Latest ranking number on the leaderboard |
score | Latest game score |
3.6. Display game results with your own UI
In the previous step, you obtained the "ranking" and "score" values. You can define your own GUI, such as dialogues, pages, etc., to render game results and reward the main game.
3.7 How to provide rewards to application users based on event game scores
If your application or service uses its own point system (e.g., scores, mileage, or virtual currency), you can convert the user's score to the application's own point system. There are two ways to convert event game scores.
Method 1)
Using maxScore in Section 3.1.2 Decode data, you can get the maximum score that can be obtained in the current event game. To convert the event game score to your point system, you need the maximum score. Please refer to the table below.
A | B | (A / B = C) | D | (C * D) |
---|---|---|---|---|
Maximum reward points allowed in the application | Maximum score of a specific event game | Constant to be converted | User scoring event game | Reward points converted in the application |
100 | 4,000 | 0.025 | 3,600 | 90 |
450 | 1,500 | 0.3 | 350 | 105 |
10,000 | 2,000 | 5 | 1,350 | 6,750 |
Method 2)
The score range of a specific event game can be adjusted by the Emoji Games service operation team. If you want to adjust the score range of a specific event game for direct use in the reward point system, please contact the Emoji Games service operation team at support@brandedminigames.com.
Last updated