Unity package: hqm_2.3.2.unitypackage
-
Install latest Unity.
-
Install Play Services Resolver
-
Download and import hqm_2.3.2.unitypackage
(Assets -> Import package -> Custom package -> hqm_2.3.2.unitypackage )
-
Force resolve dependencies:
(Assets -> Play Services Resolver -> Android Resolver -> Force Resolve)
-
You can skip this step if your
Target API Level
< 30.- Enable option
Custom Main Manifest
inBuild Settings -> Project Settings -> Player -> Publishing Settings -> Build
- Place
QUERY_ALL_PACKAGES
permission in yourAssets/Plugins/Android/AndroidManifest.xml
:
- Enable option
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.package.id">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
In order to comply with Google Play policy you also have to declare this permission using the Declaration Form in Play Console. More info
- Initialize SDK (ONLY after obtaining user consent):
...
// Init SDK
HQSdk.Init(
"your_api_key", // your api key
true); // is debug enabled
- Send user-defined event:
// Send event as text ...
HQSdk.LogEvent("test_event", "test");
- Send complex user-defined event:
// ... or as a map.
Dictionary<string, string> map = new Dictionary<string, string>();
map["test1"] = "test_value1";
map["test2"] = "test_value2";
HQSdk.LogEvent("test_event", map);
- Request predicted user groups: (HQSdk will need some time, typically 10 - 15 min, to compute user groups)
// Request predicted user group id list ...
var groupIdList = HQSdk.GetGroupIdList();
// ... or user group name list
var getGroupNameList = HQSdk.GetGroupNameList();
...
- Send target segments to Firebase Analytics. Firebase Analytics dependency must be imported separately.
HQSdk.TrackSegments(true);
-
Send predefined event
InAppPurchase(int revenue, string currency, string item_name)
.currency
- a string representing a currency id in ISO 4217 format (https://www.currency-iso.org/dam/downloads/lists/list_one.xml)
HQSdk.InAppPurchase(75, "EUR", "Useful item name");
-
Send predefined event
SubscriptionPurchase(int revenue, string currency, string item_name, string status)
.currency
- a string representing a currency id in ISO 4217 format (https://www.currency-iso.org/dam/downloads/lists/list_one.xml)status
- state of purchase event (trial/first/renewal/...)
HQSdk.InAppPurchase(75, "EUR", "Useful item name", "trial");
-
Send predefined event
TutorialStep(string step, string result)
.step
- a current step of tutorialresult
- a result of the current step
HQSdk.TutorialStep("onboarding_step_1", "start");
Startup script example: HqmUnity.cs
To comply with GDPR, we provide following user data management methods:
- Request for user data. A report with current user data will be sent to the provided email.
HQSdk.RequestUserData("some@email.org");
- User data deletion request. All current user data will be deleted from Humanteq servers.
HQSdk.DeleteUserData();