Android
These are the instructions for the Hive SDK Android for setting up promotion.
Adding libraries to use¶
Add external libraries for using Hive SDK Promotion to the module level build.gradle file. Below is an example of build.gradle.
dependencies {
// Promotion
implementation "com.com2us.android.hive:hive-promotion"
// Promotion Google In-App Review
implementation "com.com2us.android.hive:hive-promotion-google-inappreview"
// Add this if you want to use Promotion video function.
implementation "com.com2us.android.hive:youtube-helper"
}
Using Deep Links¶
Deep links are links that move users to a specific location in the app after launching the app. Promotion User Engagement supports processing for deep link schemes. To use deep links, add the following to AndroidManifest.xml.
<manifest>
<activity android:name="YOUR_MAIN_ACTIVITY">
<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="${applicationId}" />
</intent-filter>
</activity>
</manifest>
Using Deferred Deep Links¶
Deferred deep links are provided as a single URL and operate in two main ways:
- If the user has not installed the app, they are redirected to the app market to install it. After installation and launching the app, the user is taken to a specific location within the app.
- If the user has already installed the app, launching the app via the link will take them directly to a specific location within the app.
To use deferred deep links, add the following to your AndroidManifest.xml file.
<activity
android:name="com.hive.userengagement.DeferredDeeplinkActivity"
android:exported="true">
<!-- Add this when using the sandbox server -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="sandbox-promotion.qpyou.cn"
android:pathPattern="/deeplink/${applicationId}/vid/.*" />
</intent-filter>
<!-- Add this when using the production server -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="promotion.qpyou.cn"
android:pathPattern="/deeplink/${applicationId}/vid/.*" />
</intent-filter>
</activity>
Deferred deep links only support Google Play Store on Android. Configure it if you want to share friend invitation links through Hive User Acquisition(UA). You can freely use either the existing method or the deferred deep link method.
Existing UA Friend Invitation Link | UA Friend Invitation Link through Deferred Deep Link | |
Behavior | - When accessing the invitation link, users are guided to install and run the game through a web page with a UI that induces game installation and execution. - The invitation link does not contain any separate information. | - When accessing the invitation link, the user is guided to install the game (move to the market) and run the game without a separate web page. - Information can be included in the invitation link (controlled by Hive SDK). |
Supported Platforms | - When inducing installation, each market URL can be arbitrarily implemented on a self-implemented web page. | - Only Google Play Store is supported (available only when accessed through Chrome browser). |
The operation sequence for Hive User Acquisition (UA) using deferred deep links is as follows:
- User A shares a deferred deep link via a UA invitation link.
- When User B receives and accesses the app through the invitation link, the server analyzes the link information to confirm that B played the game at A's invitation: obtaining information for rewards.
- If the app is not installed on User B's device, the link guides them to install the app. If already installed, the app is launched and both A and B's information is sent to the promotion server.
Note
Deferred deep links guide users to install the app if it is not present, and deliver link information immediately after the app is launched post-installation.
Using Direct Links¶
Direct links are provided as a single URL and can be used for both User Acquisition (UA) invitation links and User Engagement (UE, deep link) features.
To use direct links, add the following to your AndroidManifest.xml in the SDK:
<manifest>
<activity android:name="YOUR_MAIN_ACTIVITY">
<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="${applicationId}.directlink" />
</intent-filter>
</activity>
</manifest>
Also, refer to the Promotion Settings in the console guide to configure direct links in the console.
The operation sequence for Hive User Acquisition (UA) and Hive User Engagement (UE) using direct links is as follows:
- User A shares a direct link via a UA invitation link.
- When User B accesses the app through the shared link, the server analyzes the link information to confirm that B played the game at A's invitation: obtaining information for rewards.
- Immediately after B accesses the app, the UE action included in the link information is performed (such as executing Hive related features, displaying UI, or running custom features defined by the game app for UE).
- If the app is not installed on User B's device, the link guides them to install the app. If already installed, the app is launched and both A and B's information is sent to the promotion server.
Note
When the app is not installed, please note the following when using direct links:
- Direct links guide users to install the app, but if the app is launched immediately after installation, the direct link information is not delivered.
- After installing the app, the user must click the direct link again to launch the app and deliver the direct link information at the same time.