static GooglePlayDownloader() { if (!RunningOnAndroid()) return; using (AndroidJavaClass downloaderServiceClass = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService")) { downloaderServiceClass.SetStatic("BASE64_PUBLIC_KEY", PublicKey); // Used by the preference obfuscater downloaderServiceClass.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84}); } }
static GooglePlayDownloader() { if (!RunningOnAndroid()) return; Environment = new AndroidJavaClass("android.os.Environment"); using (AndroidJavaClass dl_service = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService")) { // stuff for LVL -- MODIFY FOR YOUR APPLICATION! dl_service.SetStatic("BASE64_PUBLIC_KEY", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoIoWshH5wEDD3BoYogM2kJ3JEEiYoeiHdk8mGmYR024MHzIucQ8OCcAcuMy99ZAfeeV6FeKuKmpKg5kI+4e/2YY/sNW55l745UmTYXjdd89fTTpgocaLRUgxDmpLil74fgQoRG9IFRFGJnhXoRm81K9JQ2oRk8LXEX/Zte3o+MP+x9AMHRyupYnBR9RlrmKV/9e3p/rR5HPyzuL9zly0LHpOR9EYRvK5kgHSHoyFiMKhDLHODF0jGhutnjWrEVbQd2Su7Dwlyg83fXLcMk8BSNDQOvUiwdldLmAuypwASPktCQFoe5ZYdF/+A5+hi5t2jckUJAhlYJZsONB7k1ikzwIDAQAB"); // used by the preference obfuscater dl_service.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84}); } }
static GooglePlayDownloader() { if (!RunningOnAndroid()) return; Environment = new AndroidJavaClass("android.os.Environment"); using (AndroidJavaClass dl_service = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService")) { // stuff for LVL -- MODIFY FOR YOUR APPLICATION! dl_service.SetStatic("BASE64_PUBLIC_KEY", "REPLACE THIS WITH YOUR PUBLIC KEY"); // used by the preference obfuscater dl_service.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84}); } }
public static void Initialize() { SoomlaUtils.LogDebug(TAG, "Initializing CoreEvents and Soomla Core ..."); #if UNITY_ANDROID && !UNITY_EDITOR AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniStoreConfigClass = new AndroidJavaClass("com.soomla.SoomlaConfig")) { jniStoreConfigClass.SetStatic("logDebug", CoreSettings.DebugMessages); } // Initializing SoomlaEventHandler using(AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.core.unity.SoomlaEventHandler")) { jniEventHandler.CallStatic("initialize"); } // Initializing Soomla Secret using(AndroidJavaClass jniSoomlaClass = new AndroidJavaClass("com.soomla.Soomla")) { jniSoomlaClass.CallStatic("initialize", CoreSettings.SoomlaSecret); } AndroidJNI.PopLocalFrame(IntPtr.Zero); #elif UNITY_IOS && !UNITY_EDITOR soomlaCore_Init(CoreSettings.SoomlaSecret, CoreSettings.DebugMessages); #elif UNITY_WP8 && !UNITY_EDITOR SoomlaWpCore.SoomlaConfig.logDebug = CoreSettings.DebugMessages; SoomlaWpCore.Soomla.initialize(CoreSettings.SoomlaSecret); BusProvider.Instance.Register(CoreEvents.instance); #endif }
public static void Initialize() { if (Instance == null) { Instance = GetSynchronousCodeGeneratedInstance<CoreEvents>(); SoomlaUtils.LogDebug(TAG, "Initializing CoreEvents and Soomla Core ..."); #if UNITY_ANDROID && !UNITY_EDITOR AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniStoreConfigClass = new AndroidJavaClass("com.soomla.SoomlaConfig")) { jniStoreConfigClass.SetStatic("logDebug", CoreSettings.DebugMessages); } // Initializing SoomlaEventHandler using(AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.core.unity.SoomlaEventHandler")) { jniEventHandler.CallStatic("initialize"); } // Initializing Soomla Secret using(AndroidJavaClass jniSoomlaClass = new AndroidJavaClass("com.soomla.Soomla")) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = jc.GetStatic<AndroidJavaObject>("currentActivity"); jniSoomlaClass.CallStatic("initialize", currentActivity, CoreSettings.SoomlaSecret); } AndroidJNI.PopLocalFrame(IntPtr.Zero); #elif UNITY_IOS && !UNITY_EDITOR soomlaCore_Init(CoreSettings.SoomlaSecret, CoreSettings.DebugMessages); #elif UNITY_WP8 && !UNITY_EDITOR SoomlaWpCore.SoomlaConfig.logDebug = CoreSettings.DebugMessages; SoomlaWpCore.Soomla.initialize(CoreSettings.SoomlaSecret); BusProvider.Instance.Register(CoreEvents.instance); #endif } }
/// <summary> /// Load the billing service. /// </summary> protected override void _loadBillingService() { if (StoreSettings.GPlayBP && (string.IsNullOrEmpty(StoreSettings.AndroidPublicKey) || StoreSettings.AndroidPublicKey==StoreSettings.AND_PUB_KEY_DEFAULT)) { SoomlaUtils.LogError(TAG, "You chose Google Play billing service but publicKey is not set!! Stopping here!!"); throw new ExitGUIException(); } AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniSoomlaStoreClass = new AndroidJavaClass("com.soomla.store.SoomlaStore")) { jniSoomlaStore = jniSoomlaStoreClass.CallStatic<AndroidJavaObject>("getInstance"); bool success = jniSoomlaStore.Call<bool>("loadBillingService"); if (!success) { SoomlaUtils.LogError(TAG, "Couldn't load billing service! Billing functions won't work."); } } if (StoreSettings.GPlayBP) { using(AndroidJavaClass jniGooglePlayIabServiceClass = new AndroidJavaClass("com.soomla.store.billing.google.GooglePlayIabService")) { AndroidJavaObject jniGooglePlayIabService = jniGooglePlayIabServiceClass.CallStatic<AndroidJavaObject>("getInstance"); jniGooglePlayIabService.Call("setPublicKey", StoreSettings.AndroidPublicKey); jniGooglePlayIabServiceClass.SetStatic("AllowAndroidTestPurchases", StoreSettings.AndroidTestPurchases); } } AndroidJNI.PopLocalFrame(IntPtr.Zero); }
/// <summary> /// Initializes the SOOMLA SDK. /// </summary> /// <param name="storeAssets">Your game's economy.</param> /// <exception cref="ExitGUIException">Thrown if soomlaSecret is missing or has not been changed. /// </exception> protected override void _initialize(IStoreAssets storeAssets) { if (StoreSettings.GPlayBP && (string.IsNullOrEmpty(StoreSettings.AndroidPublicKey) || StoreSettings.AndroidPublicKey==StoreSettings.AND_PUB_KEY_DEFAULT)) { SoomlaUtils.LogError(TAG, "SOOMLA/UNITY You chose Google Play billing service but publicKey is not set!! Stopping here!!"); throw new ExitGUIException(); } StoreInfo.Initialize(storeAssets); AndroidJNI.PushLocalFrame(100); using(AndroidJavaObject jniStoreAssetsInstance = new AndroidJavaObject("com.soomla.unity.StoreAssets")) { using(AndroidJavaClass jniSoomlaStoreClass = new AndroidJavaClass("com.soomla.store.SoomlaStore")) { jniSoomlaStore = jniSoomlaStoreClass.CallStatic<AndroidJavaObject>("getInstance"); jniSoomlaStore.Call<bool>("initialize", jniStoreAssetsInstance); } } if (StoreSettings.GPlayBP) { using(AndroidJavaClass jniGooglePlayIabServiceClass = new AndroidJavaClass("com.soomla.store.billing.google.GooglePlayIabService")) { AndroidJavaObject jniGooglePlayIabService = jniGooglePlayIabServiceClass.CallStatic<AndroidJavaObject>("getInstance"); jniGooglePlayIabService.Call("setPublicKey", StoreSettings.AndroidPublicKey); jniGooglePlayIabServiceClass.SetStatic("AllowAndroidTestPurchases", StoreSettings.AndroidTestPurchases); } } AndroidJNI.PopLocalFrame(IntPtr.Zero); }
static GooglePlayDownloader() { if (!RunningOnAndroid()) return; #if UNITY_ANDROID Environment = new AndroidJavaClass("android.os.Environment"); using (AndroidJavaClass dl_service = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService")) { // stuff for LVL -- MODIFY FOR YOUR APPLICATION! dl_service.SetStatic("BASE64_PUBLIC_KEY", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjyEKBs14nd2xTdEfntzEy0Mp+1PgHU/eniNdcKpTd9js0nr55moP1gcEPJwgMNr17rQ5lhL2noLoDyzyzKD/pbnRNx03ZqsFjloKTPpZ4+Eh8r9+XkMIhAU7cQ+D9w0SoRIOHy/K9jPCIgtPWJXx6fMfQ4Fmx6SaWUceaeSuu9u24Y3lfckXGuZMjwVYzLojRzruxqJuUPkydrDrzGGrpfxGRkXKYeVLUI0reKYGx/GiiWoY5IGzidG2NTgvlixn47lc3Hg/nyRg8LEXlEze85ix7z38NfFhjoRufK/n2x0bAIGQZk4aOdKt69KZKVYEjL0XSTo6DUkZ74TqG9KERwIDAQAB" ); // used by the preference obfuscater dl_service.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84}); } #endif }
public static void SetLogEnabled(bool enable) { // Call plugin only when running on real device #if UNITY_IPHONE if (Application.platform != RuntimePlatform.OSXEditor) _tdSetLogEnabled(enable); #endif #if UNITY_ANDROID AndroidJavaClass tCAgent = new AndroidJavaClass("com.tendcloud.tenddata.TCAgent"); tCAgent.SetStatic("LOG_ON", enable); #endif }
public static void Initialize(string recieverName) { SoomlaUtils.LogDebug(TAG, "Initializing CoreEvents and Soomla Core ..."); #if UNITY_ANDROID && !UNITY_EDITOR AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniStoreConfigClass = new AndroidJavaClass("com.soomla.SoomlaConfig")) { jniStoreConfigClass.SetStatic("logDebug", CoreSettings.DebugMessages); } // Initializing SoomlaEventHandler using(AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.core.unity.SoomlaEventHandler")) { jniEventHandler.CallStatic("initialize"); } // Initializing Soomla Secret using(AndroidJavaClass jniSoomlaClass = new AndroidJavaClass("com.soomla.Soomla")) { jniSoomlaClass.CallStatic("initialize", CoreSettings.SoomlaSecret); } AndroidJNI.PopLocalFrame(IntPtr.Zero); #elif UNITY_IOS && !UNITY_EDITOR soomlaCore_Init(recieverName, CoreSettings.SoomlaSecret, CoreSettings.DebugMessages); #endif }
/// <summary> /// Load the billing service. /// </summary> protected override void _loadBillingService() { if (StoreSettings.GPlayBP) { if (string.IsNullOrEmpty(StoreSettings.AndroidPublicKey) || StoreSettings.AndroidPublicKey == StoreSettings.AND_PUB_KEY_DEFAULT) { SoomlaUtils.LogError(TAG, "You chose Google Play billing service, but publicKey is not set!! Stopping here!!"); throw new ExitGUIException(); } if (StoreSettings.PlaySsvValidation) { if (string.IsNullOrEmpty(StoreSettings.PlayClientId) || StoreSettings.PlayClientId == StoreSettings.PLAY_CLIENT_ID_DEFAULT) { SoomlaUtils.LogError(TAG, "You chose Google Play Receipt Validation, but clientId is not set!! Stopping here!!"); throw new ExitGUIException(); } if (string.IsNullOrEmpty(StoreSettings.PlayClientSecret) || StoreSettings.PlayClientSecret == StoreSettings.PLAY_CLIENT_SECRET_DEFAULT) { SoomlaUtils.LogError(TAG, "You chose Google Play Receipt Validation, but clientSecret is not set!! Stopping here!!"); throw new ExitGUIException(); } if (string.IsNullOrEmpty(StoreSettings.PlayRefreshToken) || StoreSettings.PlayRefreshToken == StoreSettings.PLAY_REFRESH_TOKEN_DEFAULT) { SoomlaUtils.LogError(TAG, "You chose Google Play Receipt Validation, but refreshToken is not set!! Stopping here!!"); throw new ExitGUIException(); } } } AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniSoomlaStoreClass = new AndroidJavaClass("com.soomla.store.SoomlaStore")) { jniSoomlaStore = jniSoomlaStoreClass.CallStatic<AndroidJavaObject>("getInstance"); bool success = jniSoomlaStore.Call<bool>("loadBillingService"); if (!success) { SoomlaUtils.LogError(TAG, "Couldn't load billing service! Billing functions won't work."); } } if (StoreSettings.GPlayBP) { using(AndroidJavaClass jniGooglePlayIabServiceClass = new AndroidJavaClass("com.soomla.store.billing.google.GooglePlayIabService")) { AndroidJavaObject jniGooglePlayIabService = jniGooglePlayIabServiceClass.CallStatic<AndroidJavaObject>("getInstance"); jniGooglePlayIabService.Call("setPublicKey", StoreSettings.AndroidPublicKey); using(AndroidJavaObject obj_HashMap = new AndroidJavaObject("java.util.HashMap")) { IntPtr method_Put = AndroidJNIHelper.GetMethodID(obj_HashMap.GetRawClass(), "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); object[] args = new object[2]; // client ID using(AndroidJavaObject k = new AndroidJavaObject("java.lang.String", "clientId")) { using(AndroidJavaObject v = new AndroidJavaObject("java.lang.String", StoreSettings.PlayClientId)) { args[0] = k; args[1] = v; AndroidJNI.CallObjectMethod(obj_HashMap.GetRawObject(), method_Put, AndroidJNIHelper.CreateJNIArgArray(args)); } } // client secret using(AndroidJavaObject k = new AndroidJavaObject("java.lang.String", "clientSecret")) { using(AndroidJavaObject v = new AndroidJavaObject("java.lang.String", StoreSettings.PlayClientSecret)) { args[0] = k; args[1] = v; AndroidJNI.CallObjectMethod(obj_HashMap.GetRawObject(), method_Put, AndroidJNIHelper.CreateJNIArgArray(args)); } } // refresh token using(AndroidJavaObject k = new AndroidJavaObject("java.lang.String", "refreshToken")) { using(AndroidJavaObject v = new AndroidJavaObject("java.lang.String", StoreSettings.PlayRefreshToken)) { args[0] = k; args[1] = v; AndroidJNI.CallObjectMethod(obj_HashMap.GetRawObject(), method_Put, AndroidJNIHelper.CreateJNIArgArray(args)); } } // verifyOnServerFailure using(AndroidJavaObject k = new AndroidJavaObject("java.lang.String", "verifyOnServerFailure")) { using(AndroidJavaObject v = new AndroidJavaObject("java.lang.Boolean", StoreSettings.PlayVerifyOnServerFailure)) { args[0] = k; args[1] = v; AndroidJNI.CallObjectMethod(obj_HashMap.GetRawObject(), method_Put, AndroidJNIHelper.CreateJNIArgArray(args)); } } jniGooglePlayIabService.Call("configVerifyPurchases", obj_HashMap); } jniGooglePlayIabServiceClass.SetStatic("AllowAndroidTestPurchases", StoreSettings.AndroidTestPurchases); } } AndroidJNI.PopLocalFrame(IntPtr.Zero); }
// Use this for initialization void Awake() { //next line is added to avoid the not used warning touchToListenRect.Contains(new Vector3(1,1,1)); if(instance != null){ Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); instance = this; speechDictionary = gameObject.GetComponent<SpeechAnimationDictionary>(); string fileContent = loadFile(fileName); Debug.Log ("Filecontent:"+fileContent); speechDictionary.loadDictionary(fileContent); speechDictionary.ReloadDictionary(); errorMessages.Add(3, "Audio recording error."); errorMessages.Add(5, "Other client side errors."); errorMessages.Add(9, "Insufficient permissions"); errorMessages.Add(2, "Other network related errors."); errorMessages.Add(1, "Network operation timed out."); errorMessages.Add(7, "No recognition result matched."); errorMessages.Add(8, "RecognitionService busy."); errorMessages.Add(4, "Server sends error status."); errorMessages.Add(6, "No speech input."); #if UNITY_ANDROID && !UNITY_EDITOR AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); currentActivity = jc.GetStatic<AndroidJavaObject>("currentActivity"); speechRecognition = new AndroidJavaClass("be.jannesplyson.unity3dspeechrecognition.Unity3DSpeechRecognition"); isRecognitionAvailable = speechRecognition.CallStatic<bool>("isRecognitionAvailable",currentActivity); if(isRecognitionAvailable){ speechRecognition.SetStatic<int>("maxResults",maxResults); speechRecognition.SetStatic<string>("preferredLanguage",preferredLanguage); speechRecognition.SetStatic<bool>("enableOnBeginningOfSpeech", enableOnBeginningOfSpeech); speechRecognition.SetStatic<bool>("enableOnBufferReceived", enableOnBufferReceived); speechRecognition.SetStatic<bool>("enableOnEndOfSpeech", enableOnEndOfSpeech); speechRecognition.SetStatic<bool>("enableOnEvent", enableOnEvent); speechRecognition.SetStatic<bool>("enableOnPartialResults", enableOnPartialResults); speechRecognition.SetStatic<bool>("enableOnReadyForSpeech", enableOnReadyForSpeech); speechRecognition.SetStatic<bool>("enableOnRmsChanged", enableOnRmsChanged); speechRecognition.SetStatic<bool>("autoRestart", autoRestart); speechRecognition.SetStatic<bool>("autoRestartOnResume", autoRestartOnResume); speechRecognition.SetStatic<float>("autoRestartAmpThreshold", autoRestartAmpThreshold); maxResultsJni = speechRecognition.GetStatic<int>("maxResults"); preferredLanguageJni = speechRecognition.GetStatic<string>("preferredLanguage"); enableOnBeginningOfSpeechJni = speechRecognition.GetStatic<bool>("enableOnBeginningOfSpeech"); enableOnBufferReceivedJni = speechRecognition.GetStatic<bool>("enableOnBufferReceived"); enableOnEndOfSpeechJni = speechRecognition.GetStatic<bool>("enableOnEndOfSpeech"); enableOnEventJni = speechRecognition.GetStatic<bool>("enableOnEvent"); enableOnPartialResultsJni = speechRecognition.GetStatic<bool>("enableOnPartialResults"); enableOnReadyForSpeechJni = speechRecognition.GetStatic<bool>("enableOnReadyForSpeech"); enableOnRmsChangedJni = speechRecognition.GetStatic<bool>("enableOnRmsChanged"); autoRestartJni = speechRecognition.GetStatic<bool>("autoRestart"); autoRestartOnResumeJni = speechRecognition.GetStatic<bool>("autoRestartOnResume"); autoRestartAmpThresholdJni = speechRecognition.GetStatic<float>("autoRestartAmpThreshold"); speechRecognition.CallStatic("initSpeechRecognition",currentActivity); } #endif }
public GooglePlayDownloader() { if (!RunningOnAndroid()) return; Environment = new AndroidJavaClass("android.os.Environment"); using (AndroidJavaClass dl_service = new AndroidJavaClass("com.unity3d.plugin.downloader.UnityDownloaderService")) { // stuff for LVL -- MODIFY FOR YOUR APPLICATION! //dl_service.SetStatic("BASE64_PUBLIC_KEY","MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgNP6m2wqLYCRC17+xGLxMc1JGeVU+QLQWkVfwt3lpSQoMU3ZlZ0hGlyN8nvc3RfqvtPKc2ARA41rRhtsCAwSoUezbqTA0nwP0U9bXQMfQ5wZ9BwoIR2out1nA5261ZmKyl8CByYVP6D+ElE9OYUs1XGjv0fMrUSoH/FEGOZd3tHVdBcdzj0zNg/boGTTghYQ++jOLivHDhO50YRp4Y8lilLOl+jx65P0il0pdN2MTAp9d6ODXwV/4Iohafp0yuiao9QZsG/j2VXd1FRW2nkRMYLhyvZHIkeFZ6E9p5fmbjipUhfAfmg8yIYUMy+vlFMYnFSENPN0Cp8cpGNH3b02rwIDAQAB"); dl_service.SetStatic("BASE64_PUBLIC_KEY", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh1eFVukxumUozlAOHYAjjfFV4GUYi0sTpWY1nCKmiPjRTcPZrALwDQ9P9B2yAvAkyiLvoxr22jR/lHv6CSoRXMBI/Zc0TVYC87+lLOYHag5T7U+xVwmZTz3wCHN+bhzNXBBUNbQwS5kSb/87jjQ5zKCAjB7JLfRctM0Iy62d3oz+gyNeQD2V33nSumr5O3tMCRMzRzLE3noPhGLpuJwI/NvY7/Gw7NN+JJXkgXk0PtyAjx5gcTWD3LgZwhS0M/Rs0gZNmc/3BghJp7YkP6sqRjmhgWZvaNtf9lYnCFWykBDudlHKiBkLxj9cipwV6VusEPb4FAFRc76hqEwF2/duHQIDAQAB"); // used by the preference obfuscater dl_service.SetStatic("SALT", new byte[]{1, 43, 256-12, 256-1, 54, 98, 256-100, 256-12, 43, 2, 256-8, 256-4, 9, 5, 256-106, 256-108, 256-33, 45, 256-1, 84}); } }