Created
March 25, 2021 12:46
-
-
Save lokeshsuryan/bff2c5fd967d9f2036259f71715fe810 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 HuaweiService; | |
using HuaweiService.analytic; | |
using HuaweiService.crash; | |
using System; | |
public class CrashManager : MonoBehaviour | |
{ | |
private HiAnalyticsInstance instance; | |
public void onClickReportCrash(){ | |
sendReport(); | |
} | |
private void sendReport() | |
{ | |
Application.ForceCrash(0); | |
} | |
private void Start(){ | |
instance = HiAnalytics.getInstance(new Context()); | |
instance.setAnalyticsEnabled(true); | |
CrashCollectON(); | |
AGConnectCrash.getInstance().setUserId("12345"); | |
} | |
public void setCustomValues(){ | |
AGConnectCrash.getInstance().setCustomKey("stringKey", "Crash Report"); | |
AGConnectCrash.getInstance().setCustomKey("booleanKey", false); | |
AGConnectCrash.getInstance().setCustomKey("doubleKey", 8.1); | |
AGConnectCrash.getInstance().setCustomKey("floatKey", 1.5f); | |
AGConnectCrash.getInstance().setCustomKey("intKey", 1); | |
AGConnectCrash.getInstance().setCustomKey("longKey", 9L); | |
} | |
public void CrashCollectON() | |
{ | |
AGConnectCrash.getInstance().enableCrashCollection(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment