diff --git a/Assets/Plugins/Android/AndroidManifest.xml b/Assets/Plugins/Android/AndroidManifest.xml index 8ba73c29d..858acf04d 100644 --- a/Assets/Plugins/Android/AndroidManifest.xml +++ b/Assets/Plugins/Android/AndroidManifest.xml @@ -22,7 +22,7 @@ android:debuggable="true"> - + diff --git a/Assets/Plugins/Appboy/AppboyBinding.cs b/Assets/Plugins/Appboy/AppboyBinding.cs index 83c46fc94..30519bdf4 100755 --- a/Assets/Plugins/Appboy/AppboyBinding.cs +++ b/Assets/Plugins/Appboy/AppboyBinding.cs @@ -339,6 +339,7 @@ public static void DisableSDK() { #elif UNITY_ANDROID private static AndroidJavaObject appboyUnityActivity; private static AndroidJavaObject appboy; + private static AndroidJavaObject inAppMessageUtils; void Start() { Debug.Log("Starting Appboy binding for Android clients."); @@ -366,6 +367,16 @@ public static AndroidJavaObject Appboy { return appboy; } } + + public static AndroidJavaObject InAppMessageUtils { + get { + if (inAppMessageUtils == null) { + inAppMessageUtils = new AndroidJavaClass("com.appboy.unity.utils.InAppMessageUtils"); + } + return inAppMessageUtils; + } + } + #endregion private static AndroidJavaObject GetCurrentUser() { @@ -692,15 +703,18 @@ public static void RequestFeedRefreshFromCache() { } public static void LogInAppMessageClicked(string inAppMessageJSONString) { - AppboyUnityActivity.Call("logInAppMessageClick", new object[] { inAppMessageJSONString }); + var inAppMessage = InAppMessageUtils.CallStatic("inAppMessageFromString", appboyUnityActivity, inAppMessageJSONString); + InAppMessageUtils.CallStatic("logInAppMessageClick", inAppMessage); } public static void LogInAppMessageImpression(string inAppMessageJSONString) { - AppboyUnityActivity.Call("logInAppMessageImpression", new object[] { inAppMessageJSONString }); + var inAppMessage = InAppMessageUtils.CallStatic("inAppMessageFromString", appboyUnityActivity, inAppMessageJSONString); + InAppMessageUtils.CallStatic("logInAppMessageImpression", inAppMessage); } public static void LogInAppMessageButtonClicked(string inAppMessageJSONString, int buttonID) { - AppboyUnityActivity.Call("logInAppMessageButtonClick", new object[] { inAppMessageJSONString, buttonID }); + var inAppMessage = InAppMessageUtils.CallStatic("inAppMessageFromString", appboyUnityActivity, inAppMessageJSONString); + InAppMessageUtils.CallStatic("logInAppMessageButtonClick", inAppMessage, buttonID); } public static void LogFeedDisplayed() {