Google Play Game Services

Dear all,

Anyone using GPGS these days?
My latest game could log in and display a leaderboard roughly one year ago.
After working on other things and taking a break, it does nothing.

My question is this: Does anyone actually use GPGS for anything? I wanted it to save progress, leaderboards, achievements, but seems so hard to get working (I’ve been searching old threads, etc) - and Google in general (developer console, APIs, etc) just feels like a hot mess.

Anyone got any advice? Because give up and move to Apple seems to be my gut feeling right now (and that’s pretty big coming from a lifelong PC user).
Cheers,

Nick

Any idea what we need to select here for game saves?

From what I recall, Play Services API, Google Drive API and Firebase installations API are the three that we always enabled on the Google Console for all our projects. If I disable one if these, our GPGS typically doesn’t work but we don’t use Google cloud for game saves so I cannot say about that specifically.

Thanks for reply.
I ended up enabling Drive and Game Services, as well as the Developer API as recommended here:

I’ve also followed other steps on recent threads about making sure the SHA-1 cert is identical on Play console and Could console.
I still cannot log in. Getting:

{"isError":true, "name":"login","phase":"logged in"}

and calls to isAuthenticated and isConnected return nothing.
Have removed the “if not event.isError” checks as suggested but cannot get anywhere.

Currently it feels as if this no longer supported functionality in Solar 2D. Rob’s last post attempting to support was February 2019 - seems plenty has changed since then including 0Auth requirements Google end, a new GPGS version our end - v3, which we’re also struggling to get working.

Without a big tick against GPGS which many users feel is a quality safeguard against thier Android gaming experiences it feels like a nail in the coffin for Solar2D. We need a proper updated support guide and quality checks for this functionality not disjointed Google guides and forum posts. It’s really not fun spending many months getting a app working then finding out you can’t provide these important experiences to end users. :frowning_face:

Can you briefly run the project using the legacy GPGS plugin and see if authentication goes through? I realised that even in my recent projects I’m still using the legacy plugin as I did not need the new functionality but I don’t think the API has changed a lot with regards the basic login flow.

I don’t have an android device at hand right now but I can build later today with the v3 plugin and check if things are still working. I can confirm that at least on the legacy plugin, everything is working as expected on a project that I only very recently set up for internal testing on the Play Developer Console.

Now for userInitiated=false getting:

{"errorCode":4,
"errorMessage":"sign in required",
"isError":true,
"name":"login",
"phase":"logged in"}

and userInitiated=true:

{"errorCode":10002,
"errorMessage":"sign in failed",
"isError":true,
"name":"login",
"phase":"logged in"}

I don’t seem to be able to call isAuthenticated or isConnected on this version at all.
Note: I do not use init() anywhere - a year ago I could log in and see my leaderboard without it.

I had written my login code some years back but I do seem to be calling init. This same code is working with the legacy plugin as of date-- will try to build with the new plugin and report back.

In the code below, I first make the call to init GPGS and if that goes through successfully, I initiate a login.

--function to init gpgs service
function initAndroid()

	local function initCallback(event)
		--if init was succesful, attempt user login otherwise print the error message 
		if(event.isError)then
			debugStmt.print("gameNetwork: initialisation error. "..event.errorMessage)
		else
			loginAndroid()
		end
	end	

	gpgs.init(initCallback)--init gpgs
end

--------------------------------
--function attempts to login current user into gpgs and returns a login event in the listener
--the function might also receive a callback function if the initial login was not successful or if the user logged out.
function loginAndroid(callback)
	local function loginCallback(event)
		if(event.isError)then
			debugStmt.print("gameNetwork: login error. "..event.errorMessage.." error code: "..event.errorCode)
		else
			debugStmt.print("gameNetwork: "..event.phase)
			--on successful login, call the function responsible for fetching username and id of the currently logged in player
			fetchUserInfoAndroid()
			if(callback~=nil)then
				callback()
			end
		end
	end	
	gpgs.login({userInitiated=true,listener=loginCallback})--login call for gpgs
end

Thanks but I’ve just double checked, I never used init() for sure I simply ran login then leaderboards.show and it worked.
I’ve now been trying to get logged in all week, staring at the same console/cloud pages and going round and round in circles, and I’m pretty much done.

I think the new plugin’s documentation says that calling init is now a requirement. You might want to rewrite to incorporate that. I’m pretty sure GPGS is something that’s working for lots of users so hopefully with some changes to the code, you can get it working.

I’m still using v2. After seeing another post where someone could not get v3 working, and knowing v2 was working this time last year I did not want to upgrade.

[Edit: upgraded to v3, added init(), getting exactly the same behaviour]

I looked up this error code; you should test your app via Internal testing or other options in the Google Play console. I will add this to the docs, but the reason why we don’t have a guide for everything is that we are super busy, and google(and lots of other SDK providers) constantly change how things are done.

I’m using Internal testing at the moment:

I’m not sure what you mean by “other options” - the place is a minefield.

Just deleted and recreated the tester as per that post but no change.

Just made a build with v3 and everything works without having to change a single line of code so I think we can rule out issues with the plugin at least to the extent of logging in.

These processes are often tedious with both Google and Apple constantly adding new requirements and changing things around so it’s best that you check your configuration again. Some points to check that I can think of:

  • Make sure your project is properly linked to Firebase and that you have included the google services json file in your project and also configured your build.settings to use this file.

  • Check that you have the correct app ID in the build.settings

  • Check that you have the correct license key in your config.lua

  • You also need a permission in your manifest to access user accounts. This will go into your build.settings

  • In the OAuth consent screen section of the cloud console, ensure your package ID and other details are consistent with what you have on the developer console and that your app is not in testing but in production. I think there’s a toggle for this on the OAuth settings menu in the cloud console.

  • The SHA1 fingerprint that you use on the cloud console configuration must be same as the one of the key that Google used to sign your app and not that of your local keystore that you use while building. This is an easy mistake to make so you should double check this.

  • It probably doesn’t make a difference but it might be best to ensure that your play services for this project are published on the developer console and not in a draft state.

  • In case you are loading builds directly to a device to test, it’s possible that you may accidentally have used a debug key to make the build. Just make sure that the build you’re testing was signed with the same key that you use on your production builds.

Like I said, the process is not straightforward because google have a reputation of being very indecisive and cannot manage their products properly. They’re constantly trying to force Firebase, Play Console, other APIs etc on to developers at the same time. If the plugin works for me there’s no reason it shouldn’t work for you.

2 Likes

Hi,

Thanks for checking, but I’m close to taking a time out from this…

  • Why Firebase? Not seen that mentioned anywhere, and didn’t need it before?
  • I’ve not heard of the google services json file, or how to configure it?
  • I’ve checked all relevant IDs/Keys.
  • I’m not sure how to add access to user accounts in build.settings - not seen it mentioned anywhere before.
  • My app is In production on 0Auth consent screen.
  • I updated the SHA1 on Cloud to match that of the the Console as suggested on a different thread. So neither of the ones listed on Google match the one in my local keystore (which at least one would have last time I successfully logged in).
  • I’m not sure how to check play services are draught or not - you mean Game Services?
  • Not using debug key as I’ve already extracted the SHA1 several times this week to check.

Now getting notification that Google has to verify my app again, when I attempt to do so it gives me an error.

image

So that’s pretty much that for the time being anyway.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.