Created
March 17, 2015 23:15
-
-
Save dogles/6d41dc52cc627d0a80fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public static class PacketZoom { | |
public static void Initialize(string appID, string apiKey, bool enable) { | |
#if (UNITY_IPHONE && !UNITY_EDITOR) | |
PZSpeed.Init(appID, apiKey); | |
PZSpeed.UsePZ(enable); | |
PZSpeed.ShouldReportAnalytics = true; | |
PZSpeed.MeasureAppLaunchDelay(false); | |
#elif (UNITY_ANDROID && !UNITY_EDITOR) | |
using (var client = new AndroidJavaClass("com.packetzoom.speed.PacketZoomClient")) { | |
using(var player = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { | |
client.CallStatic("Init", player.GetStatic<UnityEngine.AndroidJavaObject>("currentActivity")); | |
client.CallStatic("setEnabled", enable); | |
} | |
} | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment