Getting Started with Playblazer¶
Prepare app for Playblazer¶
Register with Playblazer to get an App ID and Secret Key if you haven’t got already.
Some modules in Playblazer platform require configuration to be done before they can be used.
The modules that require configuration are:
- social graph/social publish
- notifications (push)
We cover both in detail below.
Social Graph/Social Publish:
As of now, we use only the OAuth access token (with appropriate permissions) to fetch the social graph of the user - both with FB and Google+. The same is applicable for social publishing (posting on Google+ is under development).
However, it may change in the future as the platforms tighten the security and we MAY require you to submit the OAuth client id and client secret to be able to share/publish using the social platforms. We will inform you in advance whenever this change is required.
If you want to be able to receive push notifications on iOS and Android (both Google/GCM and Amazon/ADM) devices, you need to provide us with following configuration.
- SSL Certificate - development: in PEM format with private key included
- SSL Certificate - production: in PEM format with private key included
- Application bundle name
- Whether to enable push notifications to iOS devices or not maybe required to disable the push notifications to debug issues with the code.
Please follow the instructions on how to generate the SSL certificates from the Provisioning page from Apple Developer Portal.
For a comprehensive guide on how to set up push notification configuration for APNS, please refer to Ray Wenderlich’s Push Notifications tutorial.
- Sender ID: This is the numeric ID when an API project is created using Google API console (https://code.google.com/apis/console/)
- API Key: The API access key can be obtained from the above URL - after logging in, look under API Access -> Simple API Access under the project properties. We need to use a Server Key.
- Whether to enable push notifications to Android devices useful to disable the push notifications to debug issues with the code.
NOTE: GCM supports two methods for authenticating with the GCM servers:
- using the API access key
- using OAuth
Currently, we support the API access key method - which is simple to setup. However, we do plan to add support for OAuth authentication as well - for which, you’ll need to provide the OAuth credentials from the “API Access” page from the Google API Console. This includes “client id” and “client secret”.
Android/ADM (Android devices from Amazon):
ADM only supports OAuth method of authentication - so, we have to go by that. You’ll need to provide us with the OAuth client id and client secret. You can get those from the Amazon developer portal.
So, the items that you need to provide for push notifications to Amazon devices becomes:
- OAuth client ID
- OAuth client secret
- Whether to enable push notifications to Amazon devices useful to disable the push notifications to debug issues with the code.
You can find general information, SDK and documentation on Amazon Device Messaging portal.
Connecting to the Playblazer platform¶
The APIs exposed by the Playblazer platform are simple HTTP RESTful URLs which can be used from any platform that supports HTTP communication (either as part of core platform or with an additional library).
We’re working on building SDKs for the various platforms. Till then, HTTP is the only way to use it.
For example, on Android, you can use the android-async-http library. This page also has some simple examples on how to use the library.
For Mac OS X/iOS, here is something that may be useful: Networking in Mac OS X/iOS
With Cocos2d-x, you can either use cURL or the CCHttpClient class.
How to use cURL (libcurl) with cocos2d-x is out of the scope of this document. You may want to refer to:
The Playblazer platform APIs can generate the output in either JSON or XML. JSON is a more compact data interchange notation that’s also strictly defined and easy to parse and is the default output format - so, that’s what is used in the API reference documentation.
Depending on the platform that you use, it may already have support for parsing JSON - for example, on Android, there is already support for JSON in the package org.json.
Some platforms, however, may need external library for parsing JSON. For example, you can use the LitJSON library if you’re using C# on Unity.
For cocos2d-x (using C++), you can use the rapidjson library.
How do I decide which APIs I need to use at what point in the game?¶
In the following discussion, we try to walk through a game screen-by-screen and try and identify which APIs to invoke to gather the required data to be displayed on the screen.