AndroidMobSDKImpl.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using UnityEngine;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. namespace cn.sharesdk.unity3d {
  6. #if UNITY_ANDROID
  7. public class AndroidMobSDKImpl : MobSDKImpl {
  8. private AndroidJavaObject sdk;
  9. public AndroidMobSDKImpl(GameObject go) {
  10. try {
  11. sdk = new AndroidJavaObject("cn.sharesdk.unity3d.MobSDKUtils", go.name, "_PolicyGrantResultCallback");
  12. } catch(Exception e) {
  13. Console.WriteLine("{0} Exception caught.", e);
  14. }
  15. }
  16. public override string getPrivacyPolicy(bool url, string language) {
  17. // if (sdk != null) {
  18. // return sdk.Call<string>("getPrivacyPolicy", url);
  19. // }
  20. return "No get privacypolicy content";
  21. }
  22. public override string getDeviceCurrentLanguage() {
  23. return null;
  24. }
  25. public override Boolean submitPolicyGrantResult(bool granted) {
  26. if (sdk != null) {
  27. return sdk.Call<Boolean>("submitPolicyGrantResult", granted);
  28. }
  29. return false;
  30. }
  31. public override void setAllowDialog(bool allowDialog) {
  32. sdk.Call("setAllowDialog", allowDialog);
  33. }
  34. public override void setPolicyUi(string backgroundColorRes, string positiveBtnColorRes, string negativeBtnColorRes) {
  35. sdk.Call("setPolicyUi", backgroundColorRes, positiveBtnColorRes, negativeBtnColorRes);
  36. }
  37. }
  38. #endif
  39. }