We are writing an application in Unity3D for both iOS and Android and we'd like to use the provided Social API to retrive and post the highScores on iOS (using GameCenter) and Android (using Google Play Game Services).
To keep the application simple, its weight low and to avoid cross-compilation extra setups we'd prefer not to use external plugins (unless point 4 is true).
I googled around for documentation and tutorials and I found THIS ONE.
The implementation has been done in C#, but since the Unity guide also provides a c# version it went all straight forward.
However we couldn't manage to get this work, probably also because we don't understand well how this API really work.
First of all: the Unity guide states that "It [the api] provides a unified interface to different social back-ends, such as XBox Live or GameCenter", but in the implementation is not specified which social back-end is being used. How unity knows that? It switches depending on the platform?
Second: I understood in various guides that the GUI provided to show the leaderboard is directly provided by the host platform and from the console log i get these following success messages:
Authenticated, checking achievements
Error: no achievements found
Successfully reported achievement progress
but running the application in the editor, in a build made for windows or an apk used in BlueStacks, i get the same message when I call the function Social.ShowLeaderboardUI(); which is
ShowLeaderboardUI not implemented
I could expect it from the editor and the exe, but BlueStack emulates Android and i would be surprised if it doesn't provide the google play services. However i also read about a "sandbox mode" which is the one that should run in the editor and this leads to point three:
I can't find a way to set this sandbox mode, at least not from that guide.
Fourth point: Unity has a GameCenter class, but no classes for the Google Play Games Services, so: I can do what I want with iOS but I need an external plugin which implements the ISocial interface for Android?
Fifth point: How do i handle authentication in both sandbox and deploy mode?
As you can see I'm surely missing something on the coding side, conceptual side or both. Can you provide a step-by-step procedure on how to achieve what i need? I don't need to get pieces of source code, but if someone can explain me well how this API works it would be great.
Thanks in advance
For Android:
To integrate Google Play Service into Unity, you need to use a plugin. You can find the Google supported plugin here. You can find information on how leaderboards work here. Essentially how it works is:
You create the leaderboard in the Google Play Developer Console
You submit scores to the leaderboard created (at whenever you determin is the appropriate time)
Google Play Services sends a response back telling if it's a high score or not.
I suggest you take a look at the Cubic Pilot_4.6 sample as that demonstrates how to implement leaderboards. Also, you really ought to test this on a physical device, due to how emulators may have trouble handling Google Play Services and account logins.
As far as authentication goes, Google Play Services takes care of most of it for you. You can probably see more in the samples (Social.localUser.Authenticate).
Current implementation does only provide implementation for GameCenter and XboxLive. There's a property Social.Active which can be used to modify what social platform is used. You can set a object which implements ISocialPlatform but im not sure if that interface is fully open - thus, im not sure if anyone can implement that..
Related
I'm just coming to the end of writing my first game, last thing to do is enable backing up the user's game. I have leaderboards and achievements implemented fine, and all Google's docs say I should be saving games to Drive using .requestScopes(Drive.SCOPE_APPFOLDER) which upon trying leads me to find that it's no longer going to work in 2 months.
Digging further, I found this line from Google: "Support for storing and syncing in the app data folder will likely be removed from Drive in the future."
I'm still learning all this as I go, and I'm using Kotlin (I don't know Java). Can anyone point me in the right direction to where I should be looking to backup users game data if the way Google suggests isn't going to work very soon?
Thanks
Google is deprecating the Google Drive Android API in favor of the Google Drive REST API. Here is the best starting point for implementing that in android that I could find.
I have been struggling for many weeks to get the sample code at REST Android Quickstart to work properly, but I get a 403 error which I can't seem to fix as I cannot find the Drive SDK within the Developer Console to activate it for my app.
Now I am wondering if there is an alternative to using the REST method to achieve my original goal of creating an app that can create and edit text files within a users personal Google Drive account - NOT the Drive space allocated to the app itself - which I believe is a limitation of the Google Drive API (unless I'm mistaken)? Many thanks in advance.
Does Google Play Games has a batch-uploader for Achievements/Leaderboards like Apple's ITMSTransporter?
I have 64 Achievements, 13 Leaderboards, 12 different localizations with a title, description and image to upload. I don't really want to manually copy-paste over 3000 items.
I had to end up hacking together my own solution to this, using the Chrome javascript console. Very disappointing there doesn't seem to be an official tool or API for this.
You can see the sourcecode for my hacky solution here: https://github.com/zzymyn/gpg-batch-uploader
This is an old question, but I faced the same problem recently (had a huge list of achievements with several localizations that I needed to upload).
There's no ready-made solution but I created my own by leveraging the Play Games Services Publishing API (https://developers.google.com/games/services/publishing/). It's a REST API that lets you create and modify achievements and leaderboards. They have clients for several languages, I used the one for Ruby which is what I'm most used to.
It's a bit tricky to set up because the calls need authorization (OAuth 2) and the documentation is not very detailed (I figured out most stuff just by reading their code and samples), but the good part is that once you get it working you get a lot of flexibility.
Is it possible to reset achievements for an android application using oauth playground? I have used it in the past to reset achievements for a web application but don't know how to do it for an android application. I have the android application google game services configuration setup and running but would like to give a method to testers for reseting their achievements out of the android application.
Thanks in advance.
I'm actually going to recommend you try something completely different. The Play Games team just released a new set of management tools that provides a web interface for you to interact with the games management REST APIs, including being able to reset your achievements. You can find them here, along with some instructions about how to use them.
Please note that as part of the setup process, you're going to need to go to the Play Developer Console, jump into your game, create a linked web app, and then use that linked web app's Client ID as the Client ID you enter into the management tools.
I currently am planning a small, but useful, addition to Google Maps for Android. I was wondering if I could create a .apk file that, when installed, adds a feature to the stock Google Maps for Android. The only thing I have found is Google Add-on API, although I don't think this is what I want.
If I use the above add-on API, I would be able to create a stand-alone application which fully implements Google Maps API... right? Please give me some clarity here, and let me know if I'm missing something.
The Google Add-on API is a set of classes that allow you to show google maps inside your application. Most apps use this for simply showing a map with some sort of marker on it.
The out of the box functionality is fairly limited and not nearly as feature rich as the google maps application. With enough time and effort you could possibly build a replacement for google maps but it's not as simple as just adding on functionality.
See here for a guide on how to get started using the APIs.
It now is possible to create plugins for google maps or any other app provided you have root access for your android device. once you have the root access, you can use the Xposed framework created by one of the XDA recognised developer rovo89
Please note that this will be only available for the rooted devices that have this framework installed. Again this is an indirect way to enhance any application deployed on your device provided you have an idea of which methods you need to hook into. in the same thread mentioned there is also a link to toutorial which explains how to use the xposed framework to modify and create your own mods.
For non rooted devices, unfortunately, there is no way to implement this functionality.