siyao 4 年前
当前提交
0f26d9f0
共有 3 个文件被更改,包括 10 次插入5 次删除
  1. 2
      Assets/HuaweiServiceDemo/Scenes/HmsCrashSampleScene.unity
  2. 11
      Assets/HuaweiServiceDemo/Scripts/test/location/CrashTest.cs
  3. 2
      README.md

2
Assets/HuaweiServiceDemo/Scenes/HmsCrashSampleScene.unity


RemoteConfigEnabled: 0
AppLinkingEnabled: 0
AppMessageEnabled: 0
CrashEnable: 1
CrashEnabled: 1
btnParent: {fileID: 1003105949}
btnPrefab: {fileID: 5079351762955741576, guid: d221bb8c0c7b8476294abb3b987699b9,
type: 3}

11
Assets/HuaweiServiceDemo/Scripts/test/location/CrashTest.cs


public override void RegisterEvent(TestEvent registerEvent)
{
registerEvent("enableCrashCollection(boolean enable)", () => SetCrashCollection(true));
registerEvent("enableCrashCollection(true)", () => SetCrashCollection(true));
registerEvent("enableCrashCollection(false)", () => SetCrashCollection(false));
registerEvent("setUserId(String userId)", () => SetUserId("TestUserId"));
registerEvent("setUserId(String userId)", () => SetUserId("TestUserId2"));
registerEvent("setCustomKey(String key, String value)", () => SetCustomKey("stringKey", "world"));
registerEvent("setCustomKey(String key, boolean value)", () => SetCustomKey("booleanKey", false));
registerEvent("setCustomKey(String key, double value)", () => SetCustomKey("doubleKey", 1.1));

public void SetTestIt()
{
AGConnectCrash.getInstance().enableCrashCollection(true);
TestTip.Inst.ShowText("create crash");
Application.ForceCrash(0);
}

{
AGConnectCrash.getInstance().setCustomKey(key, value);
TestTip.Inst.ShowText($"set key: {key}," + $"set float value: {value}");
}
public void SetCustomKey(string key, int value)
{
AGConnectCrash.getInstance().setCustomKey(key, value);
TestTip.Inst.ShowText($"set key: {key}," + $"set int value: {value}");
}
public void SetCustomKey(string key, long value)
{

2
README.md


# Hms Demo
***Unity 2019 or higher***
***Before build, enter keystore password `123456`, and project key password `123456`***
***Before build, add your keystore, create huawei agc project and put `agconnect-services.json` under `Assets/Plugins/Android/`***
key store path `Edit -> Project Settings -> Player -> Android(icon) -> Publishing Settings`
正在加载...
取消
保存