Since we released our cross-promotions feature, several developers have taken advantage of this powerful tool to create trial versions of their apps in the Leap Motion App Store. To help you get started, I’ve written a quick sample that integrates the Cross-Promotions API into apps. It’s basically a single GET request – your app simply parses the JSON that it receives back to see if the cross-promoted app is active, and if it is, which URL to direct the user.
How It Works
For this sample, I’m using the built-in System.Net API to create a web request to the endpointURL. Your unique cross-promotion URL will appear in Warehouse when you set up your cross-promotion.
From here, we then use SimpleJSON, a script from the Unity wiki. Unfortunately, the built-in .NET framework in Unity doesn’t seem to support System.Web.Script.Serialization.JavaScriptSerializer, so I had to pull in a third-party script.
For further details on how the cross-promotion works and what each field means in the JSON you’ll receive, please refer to our cross-promotions API documentation (PDF).
Get Started: Unity Sample Package
You can download our example Unity package here.
Update 9/12/2014: The Airspace Store is now simply called the Leap Motion App Store. Please refer to the Developer Portal documentation for the most recent practices.
hi Pohung,
You may want to set a TimeOut on the example Unity Script that uses the WebClient .Net class.
By default it is at 100 seconds which is too much.