Hi, I am wondering how to code PlayFab into a game that I am working on in Java, I've tried using javascript within Java but I am just getting javax.script.ScriptException: ReferenceError: "XMLHttpRequest" is not defined in <eval> at line number 60
Any help for an idiot that has no idea how to code this?...
Answer by Brendan · Feb 11, 2018 at 11:37 PM
XMLHttpRequest is a JavaScript component in web browsers. If you're developing in straight Java, I'd recommend using this guide: https://api.playfab.com/docs/getting-started/java-getting-started.
@Brendan thanks, I have been looking through the link and I was still unable to find any examples except from the creation of a new user. Is there any additional guides that show code examples for GetTitleData etc for use within the games.
We have a number of examples in our tutorials (like this one: https://api.playfab.com/docs/tutorials/landing-content/using-title-data), but all the API calls are simple Web API endpoints, so effectively they're all basically the same, in how you construct them. We'll be adding more tabs to the examples in the tutorials as soon as we can.
@Brendan sorry, I’m still being blank with how to make these work with Java.
When I call any of the methods it just gives me syntax errors, any code snippets written in Java would be amazing.
Sorry,
Thank you for all your help
Can you provide the details of the calls you're making, and the responses?
@brendan my current ideas is to have the game pull down the game title information for global stuff like screen size and the game FPS. Then use the user data to store things like ammo, score and level. Then write the user data back to playfab after each level.
Sorry I’ve never used PlayFab before so I’m not used to how you build constructors for the functions
Basically, I'm needing to know how to pull player inventory in Java and how it will be saved.
How to run cloud scripts and get return values.
Pull Game Title information
What you'll want to do is use our Java SDK (https://api.playfab.com/docs/getting-started/java-getting-started) and make the calls the way shown in the readme of the GitHub repo containing the SDK - look below where it says "Set up your first API call". All the parameters for the calls are defined in our documentation, to help make this simple.
How to Upload and Download a file with the C++ SDK? 2 Answers
CDN files upload with nodejs script and https 2 Answers
Display Properties for User Generated Content? 1 Answer
How to download content from cdn? 1 Answer
Having trouble with Get content from CDN to Update my game's version in Unreal Engine 4 0 Answers