No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

78 líneas
2.1 KiB

  1. // Copyright (C) 2015 Google, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #if UNITY_ANDROID
  15. using System.Collections.Generic;
  16. using GoogleMobileAds.Common;
  17. using UnityEngine;
  18. namespace GoogleMobileAds.Android
  19. {
  20. internal class CustomNativeTemplateClient : ICustomNativeTemplateClient
  21. {
  22. private AndroidJavaObject customNativeAd;
  23. public CustomNativeTemplateClient(AndroidJavaObject customNativeAd)
  24. {
  25. this.customNativeAd = customNativeAd;
  26. }
  27. public List<string> GetAvailableAssetNames()
  28. {
  29. return new List<string>(this.customNativeAd.Call<string[]>("getAvailableAssetNames"));
  30. }
  31. public string GetTemplateId()
  32. {
  33. return this.customNativeAd.Call<string>("getTemplateId");
  34. }
  35. public byte[] GetImageByteArray(string key)
  36. {
  37. byte[] imageAssetAsByteArray = this.customNativeAd.Call<byte[]>("getImage", key);
  38. if (imageAssetAsByteArray.Length == 0)
  39. {
  40. return null;
  41. }
  42. return imageAssetAsByteArray;
  43. }
  44. public string GetText(string key)
  45. {
  46. string assetText = this.customNativeAd.Call<string>("getText", key);
  47. if (assetText.Equals(string.Empty))
  48. {
  49. return null;
  50. }
  51. return assetText;
  52. }
  53. public void PerformClick(string assetName)
  54. {
  55. this.customNativeAd.Call("performClick", assetName);
  56. }
  57. public void RecordImpression()
  58. {
  59. this.customNativeAd.Call("recordImpression");
  60. }
  61. }
  62. }
  63. #endif