Skip to content

Instantly share code, notes, and snippets.

@dogles
Created March 17, 2015 23:15
Show Gist options
  • Save dogles/6d41dc52cc627d0a80fd to your computer and use it in GitHub Desktop.
Save dogles/6d41dc52cc627d0a80fd to your computer and use it in GitHub Desktop.
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