This function is used to obtain the distinct_id of the current device.
Function
//Non-HarmonyOS Platforms
public static void getDistinctId()
//HarmonyOS Platform
public static void getDistinctId(Action<string>distinct)
Sample Code
private void GetDistinctIdHandler()
{
#if UNITY_OPENHARMONY&&!UNITY_EDITOR
SolarEngine.Analytics.getDistinctId(_distinct);
#else
string distinctId = SolarEngine.Analytics.getDistinctId();
#endif
}
#if UNITY_OPENHARMONY&&!UNITY_EDITOR
private void _distinct(string distinct)
{
string distinctId = distinct;
}
#endif
The distinct_id and distinct_id_type will be returned.
distinct_id_type | Description |
---|---|
-1 | This value will be returned for iOS or Android. |
1101 | openid is returned for MiniGame |
1102 | anonymousopenid is returned for MiniGame |
1103 | uuid is returned for MiniGame |