#if UNITY_ANDROID //&& !UNITY_EDITOR using System; using System.Reflection; using Azerion.BlueStack.Internal; using UnityEngine; namespace Azerion.BlueStack.Platforms.Android { internal class ClientsFactory : IClientsFactory { public IBlueStackClient CreateBlueStackClient() { if (Application.platform == RuntimePlatform.Android) { return BlueStackClient.Instance; } throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name + " on non-Android runtime"); } public IRewardedVideoAdClient CreatRewardedVideoAdClient() { if (Application.platform == RuntimePlatform.Android) { return new RewardedVideoAdClient(AndroidJavaObjectFactory.Instance, BlueStackErrorUtils.Instance); } throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name + " on non-Android runtime"); } public IInterstitialAdClient CreatInterstitialAdClient() { if (Application.platform == RuntimePlatform.Android) { return new InterstitialAdClient(AndroidJavaObjectFactory.Instance, BlueStackErrorUtils.Instance); } throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name + " on non-Android runtime"); } public IPreferenceClient CreateIPreferenceClient() { if (Application.platform == RuntimePlatform.Android) { return new PreferenceClient(); } throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name + " on non-Android runtime"); } public IBannerAdClient CreatBannerAdClient() { if (Application.platform == RuntimePlatform.Android) { return new BannerAdClient(AndroidJavaObjectFactory.Instance, BlueStackErrorUtils.Instance); } throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name + " on non-Android runtime"); } public INativeAdClient CreateNativeAdClient() { if (Application.platform == RuntimePlatform.Android) { return new NativeAdClient(AndroidJavaObjectFactory.Instance, BlueStackErrorUtils.Instance); } throw new InvalidOperationException(@"Called " + MethodBase.GetCurrentMethod()?.Name + " on non-Android runtime"); } } } #endif