浏览代码

update

/main
siyao 4 年前
当前提交
f273ff2b
共有 62 个文件被更改,包括 337 次插入297 次删除
  1. 4
      .DS_Store
  2. 3
      Assets/.DS_Store
  3. 168
      Assets/HuaweiHms/README.md
  4. 8
      Assets/HuaweiHms/src/Editor/AfterBuildToDo.cs
  5. 28
      Assets/HuaweiHms/src/hms/Wrapper/ads/AdListener.cs
  6. 8
      Assets/HuaweiHms/src/hms/Wrapper/ads/ConsentUpdateListener.cs
  7. 16
      Assets/HuaweiHms/src/hms/Wrapper/ads/RewardAd.cs
  8. 8
      Assets/HuaweiHms/src/hms/Wrapper/ads/RewardAdLoadListener.cs
  9. 16
      Assets/HuaweiHms/src/hms/Wrapper/ads/RewardAdStatusListener.cs
  10. 2
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessaging.cs
  11. 16
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingCallback.cs
  12. 4
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingDisplay.cs
  13. 4
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingOnClickListener.cs
  14. 4
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingOnDismissListener.cs
  15. 4
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingOnDisplayListener.cs
  16. 10
      Assets/HuaweiHms/src/hms/Wrapper/base/AGConnectServicesConfig.cs
  17. 4
      Assets/HuaweiHms/src/hms/Wrapper/base/Bundle.cs
  18. 4
      Assets/HuaweiHms/src/hms/Wrapper/base/Intent.cs
  19. 4
      Assets/HuaweiHms/src/hms/Wrapper/base/OnCompleteListener.cs
  20. 4
      Assets/HuaweiHms/src/hms/Wrapper/base/OnFailureListener.cs
  21. 4
      Assets/HuaweiHms/src/hms/Wrapper/base/OnSuccessListener.cs
  22. 4
      Assets/HuaweiHms/src/hms/Wrapper/base/PersistableBundle.cs
  23. 16
      Assets/HuaweiHms/src/hms/Wrapper/base/Task.cs
  24. 5
      Assets/HuaweiHms/src/hms/Wrapper/fundation/HmsClass.cs
  25. 17
      Assets/HuaweiHms/src/hms/Wrapper/fundation/HmsListener.cs
  26. 2
      Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionData.cs
  27. 2
      Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionInfo.cs
  28. 2
      Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionRequest.cs
  29. 2
      Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionResponse.cs
  30. 4
      Assets/HuaweiHms/src/hms/Wrapper/location/ActivityIdentificationResponse.cs
  31. 6
      Assets/HuaweiHms/src/hms/Wrapper/location/FusedLocationProviderClient.cs
  32. 2
      Assets/HuaweiHms/src/hms/Wrapper/location/GeofenceService.cs
  33. 8
      Assets/HuaweiHms/src/hms/Wrapper/location/LocationCallback.cs
  34. 4
      Assets/HuaweiHms/src/hms/Wrapper/location/LocationServices.cs
  35. 2
      Assets/HuaweiHms/src/hms/Wrapper/location/SettingsClient.cs
  36. 10
      Assets/HuaweiHms/src/hms/Wrapper/remote_config/AGConnectConfig.cs
  37. 3
      Assets/HuaweiHmsDemo/Scenes/HmsAppLinkingSampleScene.unity
  38. 51
      Assets/HuaweiHmsDemo/Scripts/test/AppLinkingTest.cs
  39. 2
      Assets/HuaweiHmsDemo/Scripts/test/ads/AdsListener.cs
  40. 2
      Assets/HuaweiHmsDemo/Scripts/test/appmessage.meta
  41. 45
      Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageListener.cs
  42. 2
      Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageListener.cs.meta
  43. 38
      Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageTest.cs
  44. 2
      Assets/Plugins/Android/AndroidManifest.xml.meta
  45. 8
      Assets/Plugins/Android/HmsAnalyticActivity.java
  46. 5
      ProjectSettings/EditorBuildSettings.asset
  47. 3
      Assets/HuaweiHms/Android/res/.DS_Store
  48. 8
      Assets/HuaweiHms/Android/res.meta
  49. 17
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/Location.cs
  50. 11
      Assets/HuaweiHms/src/hms/Wrapper/appmessage/Location.cs.meta
  51. 8
      Assets/HuaweiHms/Android/res/xml.meta
  52. 5
      Assets/HuaweiHms/src/hms/Wrapper/.DS_Store
  53. 1
      Assets/HuaweiHms/src/hms/.DS_Store
  54. 2
      Assets/HuaweiHms/src/.DS_Store
  55. 1
      Assets/HuaweiHmsDemo/Scripts/test/.DS_Store
  56. 3
      Assets/HuaweiHmsDemo/.DS_Store
  57. 8
      Assets/HuaweiHmsDemo/Android.meta
  58. 0
      /Assets/Plugins/.DS_Store
  59. 0
      /Assets/HuaweiHms/Android/res/xml
  60. 0
      /Assets/HuaweiHms/Android/res/.DS_Store

4
.DS_Store


Bud1
tsbwspblobAssetsbwspblob�bplist00�  ]ShowStatusBar[ShowPathbar[ShowToolbar[ShowTabView_ContainerShowSidebar\WindowBounds[ShowSidebar  _{{144, 202}, {770, 436}} %1=I`myz{|}~��AssetsvSrnlongTempbwspblob�bplist00�
 ]ShowStatusBar_SidebarWidthTenElevenOrLater[ShowToolbar[ShowTabView_ContainerShowSidebar\WindowBounds[ShowSidebar[ShowPathbar#@a�  _{{20, 421}, {770, 436}} 'FR^u�����������TempvSrnlong  @� @� @� @ E
 tsbwspblob Assetsbwspblob�bplist00�  ]ShowStatusBar[ShowPathbar[ShowToolbar[ShowTabView_ContainerShowSidebar\WindowBounds[ShowSidebar  _{{109, 435}, {887, 436}} %1=I`myz{|}~��AssetsdsclboolAssetslg1Scomp^AssetsmoDDblobu������AAssetsmodDblobu������AAssetsph1Scomp �AssetsvSrnlongTempbwspblob�bplist00�
 ]ShowStatusBar_SidebarWidthTenElevenOrLater[ShowToolbar[ShowTabView_ContainerShowSidebar\WindowBounds[ShowSidebar[ShowPathbar#@a�  _{{20, 421}, {770, 436}} 'FR^u�����������TempvSrnlong  @� @� @� @ E
DSDB `� @� @� @

3
Assets/.DS_Store
文件差异内容过多而无法显示
查看文件

168
Assets/HuaweiHms/README.md


# HMS
# HMS
This package enables parts of Hms Core service in Unity for Android Build, which is implemented by wrapping Hms SDK. Name and usage of corresponding classes and functions are the same. You can write code by referring [Hms SDK document](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/account-introduction-v4). But still there are some differences during development. We highly recommend downloading [example project](https://github.com/Unity-Technologies/HMSSDKSample) as a reference.
There are 4 Kits included.
* Ads Kit: [reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-development-process) and [param](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-development-process)
* Rewarded Ads
* Interstitial Ads
* Push Kit: [reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-use-cases) and [param](
https://developer.huawei.com/consumer/en/doc/development/HMS-References/push-aaid-pkg)
* all
* Location Kit: [reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/location-description) and [param](
https://developer.huawei.com/consumer/en/doc/development/HMS-References/locationv4)
* all
* Analytics Kit: [reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/Development-Guide) and [param](
https://developer.huawei.com/consumer/en/doc/development/HMS-References/3021004)
* all
## Preparation
Before doing this step, you need to create HMS Account and project according to [the HMS document](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/Preparations).
In this step, we will setup build environment for building Android apk with HMS SDK. After finish the following preparation.
### 1. Enable AndroidManifest.xml
Edit -> Project Settings -> Player -> Android(icon) -> Publishing Settings -> Build
enable `Custom Main Manifest`
`We should enable AndroidManifest when we use push or location sdk.`
**If Unity Version is 2019.2 or before, there is not AndroidManifest checkbox, but you can put `AndroidManifest.xml` under `Assets/Plugins/Android`.**
### 2. Enable project gradle
Edit -> Project Settings -> Player -> Android(icon) -> Publishing Settings -> Build
enable `Custom Base Gradle Template`
**If unity version is 2019.2 or before, you should add implement and other configuration on `MainGradleTemplate`.**
### 3. Enable app gradle
Edit -> Project Settings -> Player -> Android(icon) -> Publishing Settings -> Build
enable `Custom Launcher Gradle Template`
**If unity version is 2019.2 or before, you should add implement and other configuration on `MainGradleTemplate`.**
### 4. Enable unity library gradle
Edit -> Project Settings -> Player -> Android(icon) -> Publishing Settings -> Build
enable `Custom Main Gradle Template`
### 5. Signature
Edit -> Project Settings -> Player -> Android(icon) -> Publishing Settings -> Keystore Manager
Keytore... -> create new
`We should enter password when you open unity, otherwise We cannot build.`
**We donnot need add signature on gradle**
### 6. Package name
Edit -> Project Settings -> Player
package name is `com.${Company Name}.${Product Name}`
### 7. Agconnect-services.json
We should put json under `Assets/Plugins/Android`
`We must generate agconnect-services.json if we use analytic, push or location sdk.`
Reference [Link](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-agc-0000001050170137) to create agconnect-services.json
### 8. Get activity
For getting the activity, you can use the following code.
`Common.GetActivity()`
# SDK
There are corresponding example scene in [example project](https://github.com/Unity-Technologies/HMSSDKSample) for all 4 Kits. For test, you need to build it onto Android mobile build by HMS. Make sure you have created HMS account and project. Then, you can change the configuration and test different functions.
## Ads
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsAdsSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/ads/AdsTest.cs`.
This package enables parts of Hms App Core service and Game Services in Unity for Android Build, which is implemented by wrapping Hms SDK. Name and usage of corresponding classes and functions are the same. You can write code by referring [Huawei Hms SDK document](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/account-introduction-v4). But still there are some differences during development. please refer to the [online documentation](https://docs.unity.cn/cn/Packages-cn/com.unity.hms@1.2/manual/) during your development.
## Analytic
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsAnalyticSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/AnalyticTest.cs`.
***Analytic initialize must initialize on `onCreate` of the first activity .***
You can extend the UnityPlayerActivity file, and put java file on `Plugins/Android`.
```
public class HmsAnalyticActivity extends UnityPlayerActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
HiAnalyticsTools.enableLog();//analytic initialize
HiAnalytics.getInstance(this);
}
}
```
Then you should set activity of `AndroidManifest.xml`
```
<application>
<activity android:name="com.hms.hms_analytic_activity.HmsAnalyticActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
...
</application>
```
**if you initialize analytic, you should add analytic implentment on mainTemplate.gradle**
## Push
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsPushSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/PushTest.cs`.
We highly recommend downloading [Example Project](https://github.com/Unity-Technologies/HMSSDKSample) as a reference.
We must set service.
1. Implement interface `IPushServiceListener`
2. Get Receiver by method `PushListenerRegister.RegisterListener`
3. add to AndroidManifest.xml
```
<application>
...
<service
android:name="com.unity.hms.push.MyPushService"
android:exported="false">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT"/>
</intent-filter>
</service>
...
</application>
```
`android:name` is fixed.
## Location
***We should add implentment `com.android.support:appcompat-v7:28.0.0` to launcherTemplate***
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsLocationSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/location/LocationTest.cs`.
## App Services Documentation(Ads, Analytics, Push, Location)
https://docs.unity.cn/cn/Packages-cn/com.unity.hms@1.2/manual/
We must set receiver.
### LocationBroadcastReceiver
1. Implement interface `IBroadcastReceiver`
2. Get Receiver by method `BroadcastRegister.CreateLocationReceiver`
3. add to AndroidManifest.xml
```
<application>
...
<receiver
android:name="com.unity.hms.location.LocationBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name=`${Your action name}` />
</intent-filter>
</receiver>
...
</application>
```
`android:name` is fixed.
## Game Services Documentation
https://docs.unity.cn/cn/Packages-cn/com.unity.hms@1.2/manual/appgallery.html
You can set value of `action android:name`. But the value should be the same as the parameter of `intent.setAction`.
### GeoFenceReceiver
1. Implement interface `IBroadcastReceiver`
2. Get Receiver by method `BroadcastRegister.CreateGeoFenceReceiver`
3. add to AndroidManifest.xml
```
<application>
...
<receiver
android:name="com.unity.hms.location.GeoFenceBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name=`${Your action name}` />
</intent-filter>
</receiver>
...
</application>
```
`android:name` is fixed.
## Example Projects Download Link
https://github.com/Unity-Technologies/HMSSDKSample
You can set value of `action android:name`. But the value should be the same as the parameter of `intent.setAction`.

8
Assets/HuaweiHms/src/Editor/AfterBuildToDo.cs


public void CopyResource(string path)
{
string sourceDir = Application.dataPath + "/HuaweiHmsDemo/Android/res/xml/";
string sourceDir = Application.dataPath + "/HuaweiHms/Android/res/xml/";
if (!Directory.Exists(sourceDir))
{
return;
}
var fileList = Directory.GetFiles(sourceDir, "*.xml");
if (fileList.Length <= 0)
{

string targetDir = path + "/src/main/res/xml/";
if (!Path.HasExtension(targetDir))
if (!Directory.Exists(targetDir))
{
Directory.CreateDirectory(targetDir);
}

28
Assets/HuaweiHms/src/hms/Wrapper/ads/AdListener.cs


public class AdListener : HmsListener<AdListenerData>
{
public virtual void onAdClicked() { }
public virtual void onAdClicked() {
Call("onAdClicked");
}
public virtual void onAdClosed() { }
public virtual void onAdClosed() {
Call("onAdClosed");
}
public virtual void onAdFailed(int arg0) { }
public virtual void onAdFailed(int arg0) {
Call("onAdFailed", arg0);
}
public virtual void onAdImpression() { }
public virtual void onAdImpression() {
Call("onAdImpression");
}
public virtual void onAdLeave() { }
public virtual void onAdLeave() {
Call("onAdLeave");
}
public virtual void onAdLoaded() { }
public virtual void onAdLoaded() {
Call("onAdLoaded");
}
public virtual void onAdOpened() { }
public virtual void onAdOpened() {
Call("onAdOpened");
}
}
}

8
Assets/HuaweiHms/src/hms/Wrapper/ads/ConsentUpdateListener.cs


public class ConsentUpdateListener : HmsListener<ConsentUpdateListenerData>
{
public virtual void onSuccess(ConsentStatus arg0, bool arg1, List arg2) { }
public virtual void onSuccess(ConsentStatus arg0, bool arg1, List arg2) {
Call("onSuccess", arg0, arg1, arg2);
}
public virtual void onFail(string arg0) { }
public virtual void onFail(string arg0) {
Call("onFail", arg0);
}
}
}

16
Assets/HuaweiHms/src/hms/Wrapper/ads/RewardAd.cs


public RewardAdListener getRewardAdListener() {
return Call<RewardAdListener>("getRewardAdListener");
}
public void pause() {
Call("pause");
}
}
public void pause() {
Call("pause");
}
public void resume(Context arg0) {
Call("resume", arg0);

public bool isLoaded() {
return Call<bool>("isLoaded");
}
public void loadAd(AdParam arg0, RewardAdLoadListener arg1) {
public void loadAd(string arg0, AdParam arg1) {
public void loadAd(string arg0, AdParam arg1) {
public void loadAd(AdParam arg0, RewardAdLoadListener arg1) {
Call("loadAd", arg0, arg1);
}
public void setRewardAdListener(RewardAdListener arg0) {

Call("setRewardVerifyConfig", arg0);
}
public void show(Activity arg0, RewardAdStatusListener arg1, bool arg2) {
Call("show", arg0, arg1, arg2);
}
}
public void show(Activity arg0, RewardAdStatusListener arg1, bool arg2) {
Call("show", arg0, arg1, arg2);
}
}
}

8
Assets/HuaweiHms/src/hms/Wrapper/ads/RewardAdLoadListener.cs


public class RewardAdLoadListener : HmsListener<RewardAdLoadListenerData>
{
public virtual void onRewardedLoaded() { }
public virtual void onRewardedLoaded() {
Call("onRewardedLoaded");
}
public virtual void onRewardAdFailedToLoad(int arg0) { }
public virtual void onRewardAdFailedToLoad(int arg0) {
Call("onRewardAdFailedToLoad", arg0);
}
}
}

16
Assets/HuaweiHms/src/hms/Wrapper/ads/RewardAdStatusListener.cs


public class RewardAdStatusListener : HmsListener<RewardAdStatusListenerData>
{
public virtual void onRewardAdClosed() { }
public virtual void onRewardAdClosed() {
Call("onRewardAdClosed");
}
public virtual void onRewardAdFailedToShow(int arg0) { }
public virtual void onRewardAdFailedToShow(int arg0) {
Call("onRewardAdFailedToShow", arg0);
}
public virtual void onRewardAdOpened() { }
public virtual void onRewardAdOpened() {
Call("onRewardAdOpened");
}
public virtual void onRewarded(Reward arg0) { }
public virtual void onRewarded(Reward arg0) {
Call("onRewarded", arg0);
}
public void onRewarded(AndroidJavaObject arg0){
onRewarded(HmsUtil.GetHmsBase<Reward>(arg0));

2
Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessaging.cs


public void removeCustomView() {
Call("removeCustomView");
}
public void setDisplayLocation(Location arg0) {
public void setDisplayLocation(MessageLocation arg0) {
Call("setDisplayLocation", arg0);
}
public void trigger(string arg0) {

16
Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingCallback.cs


public class AGConnectAppMessagingCallback : HmsListener<AGConnectAppMessagingCallbackData>
{
public virtual void onMessageClick(AppMessage arg0) { }
public virtual void onMessageClick(AppMessage arg0) {
Call("onMessageClick", arg0);
}
public virtual void onMessageDismiss(AppMessage arg0, DismissType arg1) { }
public virtual void onMessageDismiss(AppMessage arg0, DismissType arg1) {
Call("onMessageDismiss", arg0, arg1);
}
public virtual void onMessageDisplay(AppMessage arg0) { }
public virtual void onMessageDisplay(AppMessage arg0) {
Call("onMessageDisplay", arg0);
}
public virtual void onMessageError(AppMessage arg0) { }
public virtual void onMessageError(AppMessage arg0) {
Call("onMessageError", arg0);
}
public void onMessageError(AndroidJavaObject arg0){
onMessageError(HmsUtil.GetHmsBase<AppMessage>(arg0));

4
Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingDisplay.cs


public class AGConnectAppMessagingDisplay : HmsListener<AGConnectAppMessagingDisplayData>
{
public virtual void displayMessage(AppMessage arg0, AGConnectAppMessagingCallback arg1) { }
public virtual void displayMessage(AppMessage arg0, AGConnectAppMessagingCallback arg1) {
Call("displayMessage", arg0, arg1);
}
public void displayMessage(AndroidJavaObject arg0, AndroidJavaObject arg1){
displayMessage(HmsUtil.GetHmsBase<AppMessage>(arg0), HmsUtil.GetHmsBase<AGConnectAppMessagingCallback>(arg1));

4
Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingOnClickListener.cs


public class AGConnectAppMessagingOnClickListener : HmsListener<AGConnectAppMessagingOnClickListenerData>
{
public virtual void onMessageClick(AppMessage arg0) { }
public virtual void onMessageClick(AppMessage arg0) {
Call("onMessageClick", arg0);
}
public void onMessageClick(AndroidJavaObject arg0){
onMessageClick(HmsUtil.GetHmsBase<AppMessage>(arg0));

4
Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingOnDismissListener.cs


public class AGConnectAppMessagingOnDismissListener : HmsListener<AGConnectAppMessagingOnDismissListenerData>
{
public virtual void onMessageDismiss(AppMessage arg0, AGConnectAppMessagingCallback.DismissType arg1) { }
public virtual void onMessageDismiss(AppMessage arg0, AGConnectAppMessagingCallback.DismissType arg1) {
Call("onMessageDismiss", arg0, arg1);
}
public void onMessageDismiss(AndroidJavaObject arg0, AndroidJavaObject arg1){
onMessageDismiss(HmsUtil.GetHmsBase<AppMessage>(arg0), HmsUtil.GetHmsBase<AGConnectAppMessagingCallback.DismissType>(arg1));

4
Assets/HuaweiHms/src/hms/Wrapper/appmessage/AGConnectAppMessagingOnDisplayListener.cs


public class AGConnectAppMessagingOnDisplayListener : HmsListener<AGConnectAppMessagingOnDisplayListenerData>
{
public virtual void onMessageDisplay(AppMessage arg0) { }
public virtual void onMessageDisplay(AppMessage arg0) {
Call("onMessageDisplay", arg0);
}
public void onMessageDisplay(AndroidJavaObject arg0){
onMessageDisplay(HmsUtil.GetHmsBase<AppMessage>(arg0));

10
Assets/HuaweiHms/src/hms/Wrapper/base/AGConnectServicesConfig.cs


public static AGConnectServicesConfig fromContext(Context arg0) {
return CallStatic<AGConnectServicesConfig>("fromContext", arg0);
}
public bool getBoolean(string arg0) {
return Call<bool>("getBoolean", arg0);
}
public int getInt(string arg0) {
return Call<int>("getInt", arg0);
public bool getBoolean(string arg0) {
return Call<bool>("getBoolean", arg0);
}
public int getInt(string arg0) {
return Call<int>("getInt", arg0);
}
public string getString(string arg0, string arg1) {
return Call<string>("getString", arg0, arg1);

4
Assets/HuaweiHms/src/hms/Wrapper/base/Bundle.cs


}
public class Bundle :HmsClass<Bundle_Data>
{
public Bundle (PersistableBundle arg0): base(arg0) { }
public Bundle (int arg0): base(arg0) { }
public Bundle (int arg0): base(arg0) { }
public Bundle (PersistableBundle arg0): base(arg0) { }
public void putByte(string arg0, byte arg1) {
Call("putByte", arg0, arg1);
}

4
Assets/HuaweiHms/src/hms/Wrapper/base/Intent.cs


public const int URI_ALLOW_UNSAFE = 4;
public const int URI_ANDROID_APP_SCHEME = 2;
public const int URI_INTENT_SCHEME = 1;
public Intent (Intent arg0): base(arg0) { }
public Intent (): base() { }
public Intent (): base() { }
public Intent (Intent arg0): base(arg0) { }
public Intent (string arg0): base(arg0) { }
public Intent setAction(string arg0) {
return Call<Intent>("setAction", arg0);

4
Assets/HuaweiHms/src/hms/Wrapper/base/OnCompleteListener.cs


public class OnCompleteListener : HmsListener<OnCompleteListenerData>
{
public virtual void onComplete(Task arg0) { }
public virtual void onComplete(Task arg0) {
Call("onComplete", arg0);
}
public void onComplete(AndroidJavaObject arg0){
onComplete(HmsUtil.GetHmsBase<Task>(arg0));

4
Assets/HuaweiHms/src/hms/Wrapper/base/OnFailureListener.cs


public class OnFailureListener : HmsListener<OnFailureListenerData>
{
public virtual void onFailure(Exception arg0) { }
public virtual void onFailure(Exception arg0) {
Call("onFailure", arg0);
}
public void onFailure(AndroidJavaObject arg0){
onFailure(HmsUtil.GetHmsBase<Exception>(arg0));

4
Assets/HuaweiHms/src/hms/Wrapper/base/OnSuccessListener.cs


public class OnSuccessListener : HmsListener<OnSuccessListenerData>
{
public virtual void onSuccess(AndroidJavaObject arg0) { }
public virtual void onSuccess(AndroidJavaObject arg0) {
Call("onSuccess", arg0);
}
}
}

4
Assets/HuaweiHms/src/hms/Wrapper/base/PersistableBundle.cs


}
public class PersistableBundle :HmsClass<PersistableBundle_Data>
{
public PersistableBundle (PersistableBundle arg0): base(arg0) { }
public PersistableBundle (int arg0): base(arg0) { }
public PersistableBundle (int arg0): base(arg0) { }
public PersistableBundle (PersistableBundle arg0): base(arg0) { }
}
}

16
Assets/HuaweiHms/src/hms/Wrapper/base/Task.cs


public class Task :HmsClass<Task_Data>
{
public Task (): base() { }
public Task addOnCompleteListener(Executor arg0, OnCompleteListener arg1) {
return Call<Task>("addOnCompleteListener", arg0, arg1);
}
}
public Task addOnCompleteListener(Executor arg0, OnCompleteListener arg1) {
return Call<Task>("addOnCompleteListener", arg0, arg1);
}
public Task addOnCompleteListener(Activity arg0, OnCompleteListener arg1) {
return Call<Task>("addOnCompleteListener", arg0, arg1);

public Task addOnSuccessListener(OnSuccessListener arg0) {
return Call<Task>("addOnSuccessListener", arg0);
}
public Task addOnSuccessListener(Activity arg0, OnSuccessListener arg1) {
public Task addOnSuccessListener(Executor arg0, OnSuccessListener arg1) {
public Task addOnSuccessListener(Executor arg0, OnSuccessListener arg1) {
public Task addOnSuccessListener(Activity arg0, OnSuccessListener arg1) {
}
public Task addOnFailureListener(Activity arg0, OnFailureListener arg1) {
return Call<Task>("addOnFailureListener", arg0, arg1);
}
public Task addOnFailureListener(Executor arg0, OnFailureListener arg1) {
return Call<Task>("addOnFailureListener", arg0, arg1);

}
public Task addOnFailureListener(Activity arg0, OnFailureListener arg1) {
return Call<Task>("addOnFailureListener", arg0, arg1);
}
}
}

5
Assets/HuaweiHms/src/hms/Wrapper/fundation/HmsClass.cs


{
return Call<bool>("equals", obj);
}
public override string ToString()
{
return Call<string>("toString");
}
}
}

17
Assets/HuaweiHms/src/hms/Wrapper/fundation/HmsListener.cs


return this;
}
}
public void Call(string name, params object[] args)
{
obj.Call(name, HmsUtil.TransferParams(args));
}
public K Call<K>(string name, params object[] args)
{
Type type = typeof(K);
bool isBase = typeof(IHmsBase).IsAssignableFrom(type);
if(isBase){
AndroidJavaObject robj = obj.Call<AndroidJavaObject>(name, HmsUtil.TransferParams(args));
IHmsBase ret = (IHmsBase)Activator.CreateInstance(type);
ret.obj = robj;
return (K)ret;
}
return obj.Call<K>(name, HmsUtil.TransferParams(args));
}
}
public class HmsListenerManager{
private const string BUILD_CLASS_NAME = "com.unity.hms.listener.{0}";

2
Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionData.cs


}
public class ActivityConversionData :HmsClass<ActivityConversionData_Data>
{
public ActivityConversionData (int arg0, int arg1, long arg2): base(arg0, arg1, arg2) { }
public ActivityConversionData (int arg0, int arg1, long arg2): base(arg0, arg1, arg2) { }
public int getActivityType() {
return Call<int>("getActivityType");
}

2
Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionInfo.cs


{
public const int ENTER_ACTIVITY_CONVERSION = 0;
public const int EXIT_ACTIVITY_CONVERSION = 1;
public ActivityConversionInfo (int arg0, int arg1): base(arg0, arg1) { }
public ActivityConversionInfo (int arg0, int arg1): base(arg0, arg1) { }
public int getActivityType() {
return Call<int>("getActivityType");
}

2
Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionRequest.cs


}
public class ActivityConversionRequest :HmsClass<ActivityConversionRequest_Data>
{
public ActivityConversionRequest (List arg0): base(arg0) { }
public ActivityConversionRequest (List arg0): base(arg0) { }
public void setDataToIntent(Intent arg0) {
Call("setDataToIntent", arg0);
}

2
Assets/HuaweiHms/src/hms/Wrapper/location/ActivityConversionResponse.cs


}
public class ActivityConversionResponse :HmsClass<ActivityConversionResponse_Data>
{
public ActivityConversionResponse (List arg0): base(arg0) { }
public ActivityConversionResponse (List arg0): base(arg0) { }
public static ActivityConversionResponse getDataFromIntent(Intent arg0) {
return CallStatic<ActivityConversionResponse>("getDataFromIntent", arg0);
}

4
Assets/HuaweiHms/src/hms/Wrapper/location/ActivityIdentificationResponse.cs


}
public class ActivityIdentificationResponse :HmsClass<ActivityIdentificationResponse_Data>
{
public ActivityIdentificationResponse (ActivityIdentificationData arg0, long arg1, long arg2): base(arg0, arg1, arg2) { }
public ActivityIdentificationResponse (List arg0, long arg1, long arg2): base(arg0, arg1, arg2) { }
public ActivityIdentificationResponse (List arg0, long arg1, long arg2): base(arg0, arg1, arg2) { }
public ActivityIdentificationResponse (ActivityIdentificationData arg0, long arg1, long arg2): base(arg0, arg1, arg2) { }
public static ActivityIdentificationResponse getDataFromIntent(Intent arg0) {
return CallStatic<ActivityIdentificationResponse>("getDataFromIntent", arg0);
}

6
Assets/HuaweiHms/src/hms/Wrapper/location/FusedLocationProviderClient.cs


public class FusedLocationProviderClient :HmsClass<FusedLocationProviderClient_Data>
{
public const string KEY_VERTICAL_ACCURACY = "verticalAccuracy";
public FusedLocationProviderClient (Context arg0): base(arg0) { }
public FusedLocationProviderClient (Context arg0): base(arg0) { }
public FusedLocationProviderClient (): base() { }
public Task flushLocations() {
return Call<Task>("flushLocations");

public Task getLocationAvailability() {
return Call<Task>("getLocationAvailability");
}
public Task removeLocationUpdates(LocationCallback arg0) {
public Task removeLocationUpdates(PendingIntent arg0) {
public Task removeLocationUpdates(PendingIntent arg0) {
public Task removeLocationUpdates(LocationCallback arg0) {
return Call<Task>("removeLocationUpdates", arg0);
}
public Task requestLocationUpdates(LocationRequest arg0, PendingIntent arg1) {

2
Assets/HuaweiHms/src/hms/Wrapper/location/GeofenceService.cs


}
public class GeofenceService :HmsClass<GeofenceService_Data>
{
public GeofenceService (Context arg0): base(arg0) { }
public GeofenceService (Context arg0): base(arg0) { }
public GeofenceService (): base() { }
public Task createGeofenceList(GeofenceRequest arg0, PendingIntent arg1) {
return Call<Task>("createGeofenceList", arg0, arg1);

8
Assets/HuaweiHms/src/hms/Wrapper/location/LocationCallback.cs


public class LocationCallback : HmsListener<LocationCallbackData>
{
public virtual void onLocationAvailability(LocationAvailability arg0) { }
public virtual void onLocationAvailability(LocationAvailability arg0) {
Call("onLocationAvailability", arg0);
}
public virtual void onLocationResult(LocationResult arg0) { }
public virtual void onLocationResult(LocationResult arg0) {
Call("onLocationResult", arg0);
}
public void onLocationResult(AndroidJavaObject arg0){
onLocationResult(HmsUtil.GetHmsBase<LocationResult>(arg0));

4
Assets/HuaweiHms/src/hms/Wrapper/location/LocationServices.cs


public static FusedLocationProviderClient getFusedLocationProviderClient(Activity arg0) {
return CallStatic<FusedLocationProviderClient>("getFusedLocationProviderClient", arg0);
}
public static SettingsClient getSettingsClient(Activity arg0) {
public static SettingsClient getSettingsClient(Context arg0) {
public static SettingsClient getSettingsClient(Context arg0) {
public static SettingsClient getSettingsClient(Activity arg0) {
return CallStatic<SettingsClient>("getSettingsClient", arg0);
}
}

2
Assets/HuaweiHms/src/hms/Wrapper/location/SettingsClient.cs


}
public class SettingsClient :HmsClass<SettingsClient_Data>
{
public SettingsClient (Context arg0): base(arg0) { }
public SettingsClient (Context arg0): base(arg0) { }
public SettingsClient (): base() { }
public Task checkLocationSettings(LocationSettingsRequest arg0) {
return Call<Task>("checkLocationSettings", arg0);

10
Assets/HuaweiHms/src/hms/Wrapper/remote_config/AGConnectConfig.cs


public static AGConnectConfig getInstance() {
return CallStatic<AGConnectConfig>("getInstance");
}
public void applyDefault(Map arg0) {
Call("applyDefault", arg0);
}
public Task fetch() {
return Call<Task>("fetch");
public void applyDefault(Map arg0) {
Call("applyDefault", arg0);
}
public Task fetch() {
return Call<Task>("fetch");
}
public ConfigValues loadLastFetched() {
return Call<ConfigValues>("loadLastFetched");

3
Assets/HuaweiHmsDemo/Scenes/HmsAppLinkingSampleScene.unity


PushEnabled: 0
LocationEnabled: 0
RemoteConfigEnabled: 0
AppLinkingEnabled: 0
AppLinkingEnabled: 1
AppMessageEnabled: 0
btnParent: {fileID: 1664072771}
btnPrefab: {fileID: 5079351762955741576, guid: d221bb8c0c7b8476294abb3b987699b9,
type: 3}

51
Assets/HuaweiHmsDemo/Scripts/test/AppLinkingTest.cs


registerEvent("open Link", OpenLink);
}
public AppLinking.Builder createBuilder()
{
return AppLinking.newBuilder()
.setPreviewType(AppLinking.LinkingPreviewType.SocialInfo)
.setUriPrefix(URI_PREFIX)
.setDeepLink(Uri.parse(DEEP_LINK))
.setAndroidLinkInfo(
AppLinking.AndroidLinkInfo.newBuilder()
.setFallbackUrl(IMAGE_URI)
.setOpenType(AppLinking.AndroidLinkInfo.AndroidOpenType.CustomUrl)
.build())
.setSocialCardInfo(
AppLinking.SocialCardInfo.newBuilder().
setTitle(TITLE)
.setImageUrl(IMAGE_URI)
.setDescription(DESCRIPTION)
.build())
.setCampaignInfo(
AppLinking.CampaignInfo.newBuilder()
.setName("name")
.setSource("AGC")
.setMedium("App")
.build())
.setExpireMinute(2);
}
AppLinking.Builder builder = AppLinking.newBuilder().setUriPrefix(URI_PREFIX)
.setDeepLink(Uri.parse(DEEP_LINK))
.setAndroidLinkInfo(AppLinking.AndroidLinkInfo.newBuilder().build())
.setSocialCardInfo(AppLinking.SocialCardInfo.newBuilder().setTitle(TITLE)
.setImageUrl(IMAGE_URI).setDescription(DESCRIPTION).build()).setCampaignInfo(
AppLinking.CampaignInfo.newBuilder().setName("name").setSource("AGC").setMedium("App").build());
AppLinking.Builder builder = createBuilder();
Uri applinkingUri = builder.buildAppLinking().getUri();
var link = applinkingUri.toString();
TestTip.Inst.ShowText($"App link: {link}");

public void CreateShortAppLinking()
{
AppLinking.Builder builder = AppLinking.newBuilder().setUriPrefix(URI_PREFIX)
.setDeepLink(Uri.parse(DEEP_LINK))
.setAndroidLinkInfo(AppLinking.AndroidLinkInfo.newBuilder().build())
.setSocialCardInfo(
AppLinking.SocialCardInfo.newBuilder()
.setTitle(TITLE)
.setImageUrl(IMAGE_URI)
.setDescription(DESCRIPTION)
.build()
).setCampaignInfo(
AppLinking.CampaignInfo.newBuilder()
.setName("name")
.setSource("AGC")
.setMedium("App")
.build()
);
AppLinking.Builder builder = createBuilder();
TestTip.Inst.ShowText("use ShortAppLinking.LENGTH.LONG");
builder.buildShortAppLinking(ShortAppLinking.LENGTH.LONG).addOnSuccessListener(new HmsSuccessListener<ShortAppLinking>((shortAppLinking) =>
{
string link = shortAppLinking.getShortUrl().toString();

2
Assets/HuaweiHmsDemo/Scripts/test/ads/AdsListener.cs


using HuaweiHms;
namespace HuaweiHmsDemo{
public class Util
public partial class Util
{
public static void showToast(string message)
{

2
Assets/HuaweiHmsDemo/Scripts/test/appmessage.meta


fileFormatVersion: 2
guid: 35b5d27f538f54422a26905ec3da2f02
guid: a33da16ec168543beb2bd01a81274a71
folderAsset: yes
DefaultImporter:
externalObjects: {}

45
Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageListener.cs


namespace HuaweiHmsDemo
{
public partial class Util
{
public static void ShowAppMessage(AppMessage arg0, string message)
{
TestTip.Inst.ShowText(message);
TestTip.Inst.ShowText($"id: {arg0.getId()}");
TestTip.Inst.ShowText($"start time: {arg0.getStartTime()}");
TestTip.Inst.ShowText($"end time: {arg0.getEndTime()}");
TestTip.Inst.ShowText($"frequency type: {arg0.getFrequencyType()}");
}
}
// base.onMessageClick(arg0);
TestTip.Inst.ShowText($"{arg0.getId()}");
TestTip.Inst.ShowText($"{arg0.getEndTime()}");
TestTip.Inst.ShowText($"{arg0.getFrequencyType()}");
Util.ShowAppMessage(arg0, "Click Listener");
}
}
public class DismissListener : AGConnectAppMessagingOnDismissListener
{
public override void onMessageDismiss(AppMessage arg0, AGConnectAppMessagingCallback.DismissType arg1)
{
// base.onMessageDismiss(arg0, arg1);
Util.ShowAppMessage(arg0, "Dismiss Listener");
TestTip.Inst.ShowText(arg1.ToString());
}
}
public class DisplayListener : AGConnectAppMessagingOnDisplayListener
{
public override void onMessageDisplay(AppMessage arg0)
{
// base.onMessageDisplay(arg0);
Util.ShowAppMessage(arg0, "Display Listener");
}
}

{
// base.displayMessage(arg0, arg1);
TestTip.Inst.ShowText($"id: {arg0.getId()}");
TestTip.Inst.ShowText($"start time: {arg0.getStartTime()}");
TestTip.Inst.ShowText($"end time: {arg0.getEndTime()}");
TestTip.Inst.ShowText($"frequency type: {arg0.getFrequencyType()}");
Util.ShowAppMessage(arg0, "Custom Display");
arg1.onMessageClick(arg0);
arg1.onMessageDismiss(arg0, AGConnectAppMessagingCallback.DismissType.BACK_BUTTON);
arg1.onMessageDisplay(arg0);
}
}

2
Assets/HuaweiHmsDemo/Scripts/test/appmessage/AppMessageListener.cs.meta


fileFormatVersion: 2
guid: 7b4205b822a0e4574a3ad9f4ef33ce41
guid: 66d2d4014daae4f32ad3038160e8798f
MonoImporter:
externalObjects: {}
serializedVersion: 2

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


public override void RegisterEvent(TestEvent registerEvent)
{
// appMessaging.setDisplayEnable(false);
registerEvent("Force Fetch", ForceFetch);
registerEvent("Add Dismiss Listener", AddDismissListener);
registerEvent("Add Display Listener", AddDisplayListener);
registerEvent("Set Display Location", SetDisplayLocation);
registerEvent("trigger", Trigger);
}
public void ShowAppMessage()

TestTip.Inst.ShowText($"set display to {showApp}");
}
public void ForceFetch()
{
appMessaging.setForceFetch();
TestTip.Inst.ShowText("force fetch");
}
public void AddOnClickListener()
{

}
public void AddDismissListener()
{
DismissListener listener = new DismissListener();
appMessaging.addOnDismissListener(listener);
TestTip.Inst.ShowText("Add on dismiss listener success");
}
public void AddDisplayListener()
{
DisplayListener listener = new DisplayListener();
appMessaging.addOnDisplayListener(listener);
TestTip.Inst.ShowText("Add on display listener success");
}
public void RegisterCustomView()
{

{
appMessaging.removeCustomView();
TestTip.Inst.ShowText("remove custom view success");
}
public void SetDisplayLocation()
{
appMessaging.setDisplayLocation(MessageLocation.BOTTOM);
TestTip.Inst.ShowText("set location");
}
public void Trigger()
{
appMessaging.trigger("justtest");
TestTip.Inst.ShowText("trigger");
}
}
}

2
Assets/Plugins/Android/AndroidManifest.xml.meta


fileFormatVersion: 2
guid: 6c90d47027de2479784ab5e0ed3020fe
guid: 0d465fe09e87449f799981ce6efe7fb6
TextScriptImporter:
externalObjects: {}
userData:

8
Assets/Plugins/Android/HmsAnalyticActivity.java


import com.huawei.hms.analytics.HiAnalyticsTools;
import com.unity3d.player.UnityPlayerActivity;
import com.huawei.agconnect.appmessaging.AGConnectAppMessaging;
import com.huawei.hms.aaid.HmsInstanceId;
private AGConnectAppMessaging appMessaging;
@Override
protected void onCreate(Bundle savedInstanceState) {

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

5
ProjectSettings/EditorBuildSettings.asset


- enabled: 0
path: Assets/HuaweiHmsDemo/Scenes/HmsAnalyticSampleScene.unity
guid: 2cda990e2423bbf4892e6590ba056729
- enabled: 1
- enabled: 0
- enabled: 1
path: Assets/HuaweiHmsDemo/Scenes/HmsAppLinkingSampleScene.unity
guid: 2a06d635f4d86455aa7a945033ca787c
m_configObjects: {}

3
Assets/HuaweiHms/Android/res/.DS_Store
文件差异内容过多而无法显示
查看文件

8
Assets/HuaweiHms/Android/res.meta


fileFormatVersion: 2
guid: 8a3d79c0d6d074867ba89a7d120f70ff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
Assets/HuaweiHms/src/hms/Wrapper/appmessage/Location.cs


using UnityEngine;
using System.Collections.Generic;
namespace HuaweiHms
{
public class MessageLocation_Data : IHmsBaseClass{
public string name => "com.huawei.agconnect.appmessaging.Location";
}
public class MessageLocation :HmsClass<MessageLocation_Data>
{
public static MessageLocation BOTTOM => HmsUtil.GetStaticValue<MessageLocation>("BOTTOM");
public static MessageLocation CENTER => HmsUtil.GetStaticValue<MessageLocation>("CENTER");
public MessageLocation (): base() { }
}
}

11
Assets/HuaweiHms/src/hms/Wrapper/appmessage/Location.cs.meta


fileFormatVersion: 2
guid: a4d1576d9d8be44a791325e7995fb560
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/HuaweiHms/Android/res/xml.meta


fileFormatVersion: 2
guid: b80f6271869ab4af79ba10ec22a69c15
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/HuaweiHms/src/hms/Wrapper/.DS_Store
文件差异内容过多而无法显示
查看文件

1
Assets/HuaweiHms/src/hms/.DS_Store
文件差异内容过多而无法显示
查看文件

2
Assets/HuaweiHms/src/.DS_Store
文件差异内容过多而无法显示
查看文件

1
Assets/HuaweiHmsDemo/Scripts/test/.DS_Store
文件差异内容过多而无法显示
查看文件

3
Assets/HuaweiHmsDemo/.DS_Store


Bud1
oidlg1ScoAndroidlg1Scomp�AndroidmoDDblob� !l���AAndroidmodDblob� !l���AAndroidph1Scomp`prefabslg1Scomp2fprefabsmoDDblobH0k8���AprefabsmodDblobH0k8���Aprefabsph1Scomp`Sceneslg1Scomp>�ScenesmoDDblob� �9���AScenesmodDblob� �9���AScenesph1Scomp Scriptslg1Scomp=|ScriptsmoDDblobz�i<���AScriptsmodDblobz�i<���AScriptsph1ScomppScriptsvSrnlong  @� @� @� @ E
DSDB `� @� @� @

8
Assets/HuaweiHmsDemo/Android.meta


fileFormatVersion: 2
guid: 012a8e6b7724b439797bd019eb473a25
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/Assets/HuaweiHms/.DS_Store → /Assets/Plugins/.DS_Store

/Assets/HuaweiHmsDemo/Android/res/xml → /Assets/HuaweiHms/Android/res/xml

/Assets/HuaweiHmsDemo/Android/res/.DS_Store → /Assets/HuaweiHms/Android/res/.DS_Store

正在加载...
取消
保存