Here’s a module I made that handles logging in, posting to a leaderboard, and earning achievements. It works for both Game Center and Google Play, assuming that both have the same Leaderboard ID and Achievement IDs (Apple let’s you set these, so just copy the Google Play IDs).
This file assumes you’ve created the leaderboards/achievements in Google Play, and have set up your build.settings file accordingly.
local gameNetwork = require("gameNetwork") local this = {} local function gameNetworkListener(event) local targetAppStore = system.getInfo("targetAppStore") if event.data and targetAppStore == "apple" then this.isLoggedIn = true elseif targetAppStore ~= "apple" and not event.isError then local type = event.type if type == "init" then this.hasInitialized = true gameNetwork.request("login", {userInitiated = true, listener = gameNetworkListener}) elseif type == "login" then this.isLoggedIn = true end end end function this.checkAchievements(value, type) if type == "score" then if value == 500 then gameNetwork.request("unlockAchievement", {achievement = {identifier = this.achievement1, showsCompletionBanner = true}}) end end end function this.login() if system.getInfo("targetAppStore") == "apple" then gameNetwork.init("gamecenter", gameNetworkListener) elseif not this.hasInitialized then gameNetwork.init("google", gameNetworkListener) else gameNetwork.request("login", {userInitiated = true, listener = gameNetworkListener}) end end function this.initialize() this.login() this.category = "Leaderboard ID" -- Replace this this.achievement1 = "Achievement ID" -- Replace this end function this.updateHighscore(score) gameNetwork.request("setHighScore", {localPlayerScore = {category = this.category, value = score}}) end return this
Whenever my game starts, I simply require the file and call initialize(). It will prompt the user if necessary, or automatically log them in if they have done so previously.
Also, before I post a score or check for an achievement, I make sure that isLoggedIn = true. If not, call login().
if gameNetwork.isLoggedIn then -- Post a score, etc. else gameNetwork.login() end
Hopefully this will help you. 
I use this in my game, Echo Evasion. Check it out! http://www.slatebit.com/echoevasion