浏览代码

update

/main
siyao 4 年前
当前提交
182e3612
共有 3 个文件被更改,包括 44 次插入19 次删除
  1. 56
      Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageTest.cs
  2. 2
      Assets/Plugins/Android/HmsAnalyticActivity.java
  3. 5
      ProjectSettings/EditorBuildSettings.asset

56
Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageTest.cs


using System.Security.Cryptography;
using HuaweiHms;
using UnityEngine;
using HuaweiHms;
namespace HuaweiHmsDemo
{

{
if (_appMessaging == null)
{
_appMessaging = AGConnectAppMessaging.getInstance();
_appMessaging = AGConnectAppMessaging.getInstance();
}
return _appMessaging;

private AGConnectAppMessaging _appMessaging;
public bool showApp = false;
public bool showMessage = false;
public bool fetchMessage = false;
public static string EVENTNAME = "JUSTTEST";
// appMessaging.setDisplayEnable(false);
registerEvent("Show/Hide App Message State", ShowAppMessageState);
registerEvent("Enable/Disable Fetch Message", EnableFetchMessage);
registerEvent("Enable/Disable Fetch Message State", EnableFetchMessageState);
registerEvent("Force Fetch", ForceFetch);
registerEvent("Add OnClick Listener", AddOnClickListener);
registerEvent("Add Dismiss Listener", AddDismissListener);

public void ShowAppMessage()
{
showApp = !showApp;
appMessaging.setDisplayEnable(showApp);
TestTip.Inst.ShowText($"set display to {showApp}");
showMessage = !showMessage;
appMessaging.setDisplayEnable(showMessage);
TestTip.Inst.ShowText($"set display to {showMessage}");
}
public void ShowAppMessageState()
{
var enable = appMessaging.isDisplayEnable();
TestTip.Inst.ShowText($"is display enable {enable}");
public void EnableFetchMessage()
{
fetchMessage = !fetchMessage;
appMessaging.setFetchMessageEnable(fetchMessage);
TestTip.Inst.ShowText($"set fetch message to {fetchMessage}");
}
public void EnableFetchMessageState()
{
var enable = appMessaging.isFetchMessageEnable();
TestTip.Inst.ShowText($"is fetch enable: {enable}");
}
public void ForceFetch()
{
appMessaging.setForceFetch();

public void AddOnClickListener()
{
ClickListener listener = new ClickListener();
ClickListener listener = new ClickListener();
DismissListener listener = new DismissListener();
DismissListener listener = new DismissListener();
DisplayListener listener = new DisplayListener();
DisplayListener listener = new DisplayListener();
appMessaging.addOnDisplayListener(listener);
TestTip.Inst.ShowText("Add on display listener success");
}

CustomDisplayView view = new CustomDisplayView();
CustomDisplayView view = new CustomDisplayView();
appMessaging.addCustomView(view);
TestTip.Inst.ShowText("Add custom view success");
}

public void Trigger()
{
appMessaging.trigger("justtest");
appMessaging.trigger(EVENTNAME);
TestTip.Inst.ShowText("trigger");
}
}

2
Assets/Plugins/Android/HmsAnalyticActivity.java


HiAnalytics.getInstance(this);
appMessaging = AGConnectAppMessaging.getInstance();
appMessaging.setFetchMessageEnable(true);
appMessaging.setDisplayEnable(false);
appMessaging.setDisplayEnable(true);
appMessaging.setForceFetch();
}
}

5
ProjectSettings/EditorBuildSettings.asset


- enabled: 0
path: Assets/HuaweiHmsDemo/Scenes/HmsAdsSampleScene.unity
guid: a518e96ecc8f24c66a12be14f8900ec4
- enabled: 1
- enabled: 0
- enabled: 1
path: Assets/HuaweiHmsDemo/Scenes/HmsAppMessageSampleScene.unity
guid: b3476cb507ef74fc3ba3f5a751256fe8
m_configObjects: {}
正在加载...
取消
保存