|
| 1 | +using UnityEngine; |
| 2 | + |
| 3 | + |
| 4 | +public class TalkingDataSDKConfig |
| 5 | +{ |
| 6 | + public AndroidJavaObject javaObj; |
| 7 | + |
| 8 | + public static TalkingDataSDKConfig CreateConfig() |
| 9 | + { |
| 10 | + if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) |
| 11 | + { |
| 12 | + TalkingDataSDKConfig config = new TalkingDataSDKConfig(); |
| 13 | +#if UNITY_ANDROID |
| 14 | + config.javaObj = new AndroidJavaObject("com.tendcloud.tenddata.TalkingDataSDKConfig"); |
| 15 | +#endif |
| 16 | + return config; |
| 17 | + } |
| 18 | + return null; |
| 19 | + } |
| 20 | + |
| 21 | + public TalkingDataSDKConfig SetIMEIAndMEIDEnabled(bool enabled) |
| 22 | + { |
| 23 | + if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) |
| 24 | + { |
| 25 | +#if UNITY_ANDROID |
| 26 | + javaObj.Call<AndroidJavaObject>("setIMEIAndMEIDEnabled", enabled); |
| 27 | +#endif |
| 28 | + return this; |
| 29 | + } |
| 30 | + return null; |
| 31 | + } |
| 32 | + |
| 33 | + public TalkingDataSDKConfig SetMACEnabled(bool enabled) |
| 34 | + { |
| 35 | + if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) |
| 36 | + { |
| 37 | +#if UNITY_ANDROID |
| 38 | + javaObj.Call<AndroidJavaObject>("setMACEnabled", enabled); |
| 39 | +#endif |
| 40 | + return this; |
| 41 | + } |
| 42 | + return null; |
| 43 | + } |
| 44 | + |
| 45 | + public TalkingDataSDKConfig SetAppListEnabled(bool enabled) |
| 46 | + { |
| 47 | + if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) |
| 48 | + { |
| 49 | +#if UNITY_ANDROID |
| 50 | + javaObj.Call<AndroidJavaObject>("setAppListEnabled", enabled); |
| 51 | +#endif |
| 52 | + return this; |
| 53 | + } |
| 54 | + return null; |
| 55 | + } |
| 56 | + |
| 57 | + public TalkingDataSDKConfig SetLocationEnabled(bool enabled) |
| 58 | + { |
| 59 | + if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) |
| 60 | + { |
| 61 | +#if UNITY_ANDROID |
| 62 | + javaObj.Call<AndroidJavaObject>("setLocationEnabled", enabled); |
| 63 | +#endif |
| 64 | + return this; |
| 65 | + } |
| 66 | + return null; |
| 67 | + } |
| 68 | + |
| 69 | + public TalkingDataSDKConfig SetWifiEnabled(bool enabled) |
| 70 | + { |
| 71 | + if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) |
| 72 | + { |
| 73 | +#if UNITY_ANDROID |
| 74 | + javaObj.Call<AndroidJavaObject>("setWifiEnabled", enabled); |
| 75 | +#endif |
| 76 | + return this; |
| 77 | + } |
| 78 | + return null; |
| 79 | + } |
| 80 | +} |
0 commit comments