Created
December 14, 2020 07:09
-
-
Save gmYusuf/82e1375d1654d497e8671a0fbcc57a17 to your computer and use it in GitHub Desktop.
HMS Analytics kit controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using HuaweiMobileServices.Analystics; | |
using HuaweiMobileServices.Utils; | |
using UnityEngine.UI; | |
using System.Net.Mail; | |
namespace HmsPlugin | |
{ | |
public class AnalyticsDemoManager: MonoBehaviour | |
{ | |
private AnalyticsManager analyticsManager; | |
InputField eventID, key, value; | |
void InitilizeAnalyticsInstane() | |
{ | |
eventID = GameObject.Find("EventId").GetComponent<InputField>(); | |
key = GameObject.Find("Param1").GetComponent<InputField>(); | |
value = GameObject.Find("Param2").GetComponent<InputField>(); | |
} | |
public void SendEvent() | |
{ | |
SendEvent(eventID.text, key.text, value.text); | |
} | |
void SendEvent(string eventID, string key, string value) | |
{ | |
if(string.IsNullOrEmpty(eventID) && string.IsNullOrEmpty(key) && string.IsNullOrEmpty(value)) | |
{ | |
Debug.Log("[HMS]: Fill Fields"); | |
} | |
else | |
{ | |
analyticsManager.SendEventWithBundle(eventID, key, value); | |
} | |
} | |
// Start is called before the first frame update | |
void Start() | |
{ | |
InitilizeAnalyticsInstane(); | |
analyticsManager = AnalyticsManager.GetInstance(); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment