Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Basic configuration

dwd31415 edited this page Sep 7, 2014 · 4 revisions

How to make sure the game doesn't crashes on older devices without GPGS?(Android)

You don't need to do anything else than setting the main activity of your app to the MainActvity class. This class will then check for the GPGS and if they don't exist it will start an activity without any GPGS functionality, but if they exist it will start one with all the GameSharing GPGS features that are available. The actual game content doesn't differs on both activities, but on the one without GPGS the C++ GPGS calls will just display a message that GPGS is not available on that device.

How to set the leaderboards and achievements IDs

Android: To have a very small amount of data, that is transferred between C++ and Java these IDs are not set in your C++ code, but over the R IDs. In order to set these IDs create a string with all leaderboards ids ( separated by ";") in your res/values/ids.xml file and call it "leaderboards" and then add one for all the achievement IDs and call it "achievements". You can access the IDs over their index in the list. The first one has index zero. Here are some a C++ examples:

//Unlocks the first achievement in your list

GameSharing::UnlockAchivement(0);

//Unlocks the fifth achievement in your list

GameSharing::UnlockAchivement(4);

iOS: On iOS you must create a ios_ids.plist file in your Resources folder, to store your ids. Create two keys in it:"Achievements" and "Leaderboards" set their type to array and then add all your ids to the right category, then use there indexes in the array in your c++ code:

//Unlocks the first achievement in your list

GameSharing::UnlockAchivement(0);

//Unlocks the fifth achievement in your list

GameSharing::UnlockAchivement(4);