diff --git a/Assets/AirConsole/scripts/Runtime/AirConsole.cs b/Assets/AirConsole/scripts/Runtime/AirConsole.cs index 3cf459b4..b8a22afb 100644 --- a/Assets/AirConsole/scripts/Runtime/AirConsole.cs +++ b/Assets/AirConsole/scripts/Runtime/AirConsole.cs @@ -6,7 +6,6 @@ using System.Collections.ObjectModel; using System; using System.Diagnostics; -using System.Threading; using NDream.AirConsole.Android.Plugin; using WebSocketSharp.Server; using Newtonsoft.Json.Linq; @@ -2115,6 +2114,8 @@ private void CreateAndroidWebview(string connectionUrl) { url += $"&bundle-version={GetAndroidBundleVersionCode()}"; } + androidGameVersion = AndroidIntentUtils.GetIntentExtraString("game_version", androidGameVersion); + url += "&game-id=" + Application.identifier; url += "&game-version=" + androidGameVersion; url += "&unity-version=" + Application.unityVersion; diff --git a/Assets/AirConsole/scripts/Runtime/Plugin/Android/AndroidUnityUtils.cs b/Assets/AirConsole/scripts/Runtime/Plugin/Android/AndroidUnityUtils.cs index 2d7d5cec..1bfcf6d8 100644 --- a/Assets/AirConsole/scripts/Runtime/Plugin/Android/AndroidUnityUtils.cs +++ b/Assets/AirConsole/scripts/Runtime/Plugin/Android/AndroidUnityUtils.cs @@ -11,7 +11,7 @@ public static string GetIntentExtraString(string key, string defaultValue) { using (AndroidJavaClass unityPlayer = new("com.unity3d.player.UnityPlayer")) { AndroidJavaObject currentActivity = unityPlayer.GetStatic("currentActivity"); AndroidJavaObject intent = currentActivity.Call("getIntent"); - return intent.Call("getStringExtra", key); + return intent.Call("getStringExtra", key) ?? defaultValue; } } catch (System.Exception e) { AirConsoleLogger.LogWarning(() => "Error getting intent extra: " + e); diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b3bcb51..52ed8b1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This includes security related updates like requiring fixed Unity versions and i - **Unity API:** `OnMaximumVolumeChanged` event to notify when the games maximum volume must be changed. - **Android:** After the last device disconnects, the webview is reset along the game state. +- **Android:** Add support to override the game version used in a previously built android game through intent extras with adb. ### Removed