Skip to content

Instantly share code, notes, and snippets.

@lokeshsuryan
Created March 25, 2021 12:46
Show Gist options
  • Save lokeshsuryan/bff2c5fd967d9f2036259f71715fe810 to your computer and use it in GitHub Desktop.
Save lokeshsuryan/bff2c5fd967d9f2036259f71715fe810 to your computer and use it in GitHub Desktop.
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