Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Gaming plugin always login failed for google play — Gideros Forum

Gaming plugin always login failed for google play

XmanXman Member
edited October 2018 in Plugins
I used the google play services plugins in my project, and it can login and use the leaderboard without any problem.
Today, I switched to the Gaming plugin, and the code for using it is quite straightforward

pcall(require, "gaming")

game = Gaming.new("googleplay")

game:addEventListener(Event.LOGIN_ERROR, function(e) print("LOGIN_ERROR") AlertDialog.new("failed", e.error, "OK"):show() end)
game:addEventListener(Event.LOGIN_COMPLETE, function(e) print("LOGIN_COMPLETE") AlertDialog.new("success", "login complete", "OK"):show() end)

game:login()

It always login failed, since the google play services plugin works well in the same project with the same package name, I think the project configuration and the console settings in google play store is OK.

I spent all my day on that issue, but have no result, finally, I have to change back to the google play plugin and everything comes to work again.

are there any special settings need for this Gaming plugin?

Comments

  • I use 'Gaming' plugin, it works for me.
    But I never see google's auth progressbar.
    require "gaming"
    gp=Gaming.new("googleplay")
    gp:login()
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • Google have recently (in the last months) made Google Drive a requirement for their Gaming Services. You now need to enable Google Drive API in the dashboard for it to work. Could this be the issue?
    My Gideros games: www.totebo.com
    +1 -1 (+3 / -0 )Share on Facebook
  • It's the same after enable drive API

    Name
    Google Drive API
    By
    Google
    Service name
    drive.googleapis.com
    Overview
    The Google Drive API allows clients to access resources from Google Drive.
    Activation status
    Enabled
  • @Xman : Check you have the correct google app id in all the plugin settings that needs it (ads, gaming, firebase, etc).

    This code below works - because I added it to a game that didn't even try to log in to google play before yesterday. It logs in now.
    pcall(function() require "gaming" end)
    if Gaming then
    	if android then
    		gaming=Gaming.new("googleplay")
    	elseif ios then
    		gaming=Gaming.new("gamekit")
    	end
    	if gaming then
    		gaming:addEventListener(Event.LOGIN_COMPLETE,function()
    			print("gaming LOGIN_COMPLETE")
    			login=true
    			if pirateCopy then
    				pirateCopy=false
    				saveSettings()
    			end
    			gaming:getPlayerInfo()
     
     
    		end)
     
    		gaming:addEventListener(Event.LOGIN_ERROR,function(e)
    			print("gaming LOGIN_ERROR:"..e.error)
    			if e.error=="No license." then
    				if not pirateCopy then
    					pirateCopy=true
    					saveSettings()
    					message("No license.")
    				end
    			end
    			login=false
    			tryLogin=false
    			gaming:logout()
    		end)
     
    		gaming:addEventListener(Event.PLAYER_INFORMATION_COMPLETE,function(e)
    			print("gaming PLAYER_INFORMATION_COMPLETE")
    			if e.id then	
    				if e.name then
    					gamingName=e.name
    					if gamingName=="SinisterSoft" then gamingName="Anthony" end
    				end
    				print("Gaming name",gamingName)
    			end
     
    			-- now load achievements
    			gaming:loadAchievements()
    		end)
     
    		gaming:addEventListener(Event.PLAYER_INFORMATION_ERROR,function(e)
    			print("gaming PLAYER_INFORMATION_ERROR:"..e.error)
    		end)
     
    		gaming:addEventListener(Event.PLAYER_SCORE_COMPLETE,function(e)
    			print("gaming PLAYER_SCORE_COMPLETE")
    			print("Score",e.score,"Rank",e.rank,"Time",e.timestamp)
    		end)
     
    		gaming:addEventListener(Event.PLAYER_SCORE_ERROR,function(e)
    			print("gaming PLAYER_SCORE_ERROR:"..e.error)
    		end)
     
    		gaming:addEventListener(Event.LOAD_ACHIEVEMENTS_COMPLETE,function(e)
    			print("gaming LOAD_ACHIEVEMENTS_COMPLETE")
    			dump(e)
     
    			-- now load scores
    			gaming:loadScores(leaderboards[1],2,1,25)	--leaderboard,span,collection,max results
    		end)
     
    		gaming:addEventListener(Event.LOAD_ACHIEVEMENTS_ERROR,function(e)
    			print("gaming LOAD_ACHIEVEMENTS_ERROR:"..e.error)
    		end)
     
    		gaming:addEventListener(Event.REPORT_ACHIEVEMENT_COMPLETE,function(e)
    			print("gaming REPORT_ACHIEVEMENT_COMPLETE")
    		end)
     
    		gaming:addEventListener(Event.REPORT_ACHIEVEMENT_ERROR,function(e)
    			print("gaming REPORT_ACHIEVEMENT_ERROR:"..e.error)
    		end)
     
    		gaming:addEventListener(Event.LOAD_SCORES_COMPLETE,function(e)
    			print("gaming LOAD_SCORES_COMPLETE")
    			local scores=e.scores
    			if scores then
    				for loop=1,#scores do
    					print(scores[loop].name,scores[loop].timestamp,scores[loop].formattedScore,scores[loop].score,scores[loop].rank,scores[loop].playerId)
    				end
    			end
     
    			--gaming:loadState(0)  -- now load game state
    		end)
     
    		gaming:addEventListener(Event.LOAD_SCORES_ERROR,function(e)
    			print("gaming LOAD_SCORES_ERROR: no scores?")--..e.error)
    		end)
     
    		gaming:addEventListener(Event.REPORT_SCORE_COMPLETE,function(e)
    			print("gaming REPORT_SCORE_COMPLETE")
    			print("Score",e.score,"Rank",e.rank,"Time",e.timestamp)
    		end)
     
    		gaming:addEventListener(Event.REPORT_SCORE_ERROR,function(e)
    			print("gaming REPORT_SCORE_ERROR:"..e.error)
    		end)
     
    		gaming:addEventListener(Event.STATE_LOADED,function(e)
    			print("gaming STATE_LOADED")
    		end)
     
    		gaming:addEventListener(Event.STATE_ERROR,function(e)
    			print("gaming STATE_ERROR:"..e.error)
    		end)
     
    		gaming:addEventListener(Event.STATE_CONFLICT,function(e)
    			print("gaming STATE_CONFLICT")
    		end)
     
    		gaming:addEventListener(Event.STATE_DELETED,function(e)
    			print("gaming STATE_DELETED")
    		end)
     
    	end
    else
    	print("Gaming plugin not installed.")
    end
     
     
    -- call login when you want to - eg, after loading or before player starts game
    	if gaming and not login then
    		print("gaming ok")
    		if tryLogin then
    			print("trying login")
    			gaming:login()
    		end
    	end

    With these being defined earlier:
    leaderboards={"xxx a leaderboard code xxx"}
    local login=false
    local tryLogin=true
    local gamingName="Guest"
    android=true

    And a function called 'saveSettings()' that saves the settings, that have been previously loaded!

    It also looks for my google name (sinistersoft) for the leaderboard and changes it to Anthony.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @hgy29 I did notice that this gets fired - even though scores complete gest fired - with no apparent error (e.error doesn't exist and would crash the program!)...

    gaming:addEventListener(Event.LOAD_SCORES_ERROR,function(e)
    print("gaming LOAD_SCORES_ERROR: no scores?")--..e.error)
    end)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @Xman : I just thought - it could be you haven't installed the program EVER from GooglePlay and have clicked the extra piracy check in the play store settings?

    If this is the case then you will get the login error and a 'not licenced' message (see the code above). To fix this just go to google play and install the program officially. If not released then upload it as an alpha apk and again install from the store at least once.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • Maybe it's my lucky day today, after tens of login failed, it login successfully.
    I modified nothing.
    +1 -1 (+3 / -0 )Share on Facebook
  • Thanks everybody's kind suggestions.

    Likes: totebo

    +1 -1 (+1 / -0 )Share on Facebook
  • Sometimes it just takes ages for things to happen with the Play Store. Glad to hear it now functions as it should.

    Likes: totebo

    +1 -1 (+1 / -0 )Share on Facebook
  • Apollo14Apollo14 Member
    edited October 2018
    btw don't agree to Google's additional apk signing after uploading your app to console
    this crap may create unnecessary problems for you later on

    Likes: antix

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.