Google GameNetwork doesn't work on all Android versions

Hi all,

I’m currently trying to get Google Play Game Services to work with Corona SDK. But it seems to me that I have an odd issue:

I have a Samsung Tablet SM-T520 (Android 4.4.2) and my implementation works just fine. I can connect to the gameNetwork just normal.

However on my Samsung S6 (Android 6.0.1) it does not work at all. I only get the isError variable set to true.

Using logcat I do get the following Error message from google:

28062 28104 E GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

The S6 can’t connect at all.

I do not get any further information on any error Code or error message those values are always nil.

Thank you very much for your help!

My implementation looks like this:

local lGameNetwork = require( "gameNetwork" ) local inspect = require('inspect') local function gameLoginCallback( event ) print("gameLoginCallback") --print(inspect(event)) print( "gameLoginCallback-event.errorMessage", event.errorMessage ) print( "gameLoginCallback-Error Code:", event.errorCode ) end local function gameRequestCallback( event ) --print(inspect(event)) if event.name == "init" then lGameNetwork.request( "login", { userInitiated = true, listener = gameLoginCallback } ) end print( "gameRequestCallback-event.errorMessage", event.errorMessage ) print( "gameRequestCallback-Error Code:", event.errorCode ) end function setUpGameNetwork() print("setUpGameNetwork") if lGameNetwork.request("isConnected") then return end print("globalGameNetwork.init") lGameNetwork.init( "google", gameRequestCallback ) print("globalGameNetwork inspect") --print(inspect(lGameNetwork)) end function gameNetworkIsConnected() local gnc = lGameNetwork.request("isConnected") print(gnc) return gnc end function getGameNetwork() return lGameNetwork end Runtime:addEventListener( "system", setUpGameNetwork )

my build.settings like this:
I did set the googlePlayGamesAppId to the correct id of the google play services
 

settings = { android = { --123456789012 googlePlayGamesAppId = "123456789012", usesPermissions = { "android.permission.VIBRATE", "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.VIBRATE", --flurry "android.permission.ACCESS\_FINE\_LOCATION", --fetches location via GPS "android.permission.ACCESS\_COARSE\_LOCATION", --fetches location via WiFi or cellular service "com.android.vending.BILLING", "android.permission.RECEIVE\_BOOT\_COMPLETED", }, usesFeatures = { -- If you set permissions "ACCESS\_FINE\_LOCATION" and "ACCESS\_COARSE\_LOCATION" above, -- you should set the app to NOT require location services: { name="android.hardware.location", required=false }, { name="android.hardware.location.gps", required=false }, { name="android.hardware.location.network", required=false }, }, }, plugins = { ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.ads.vungle"] = { publisherId = "com.vungle", }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, --analytics ["CoronaProvider.analytics.flurry"] = { publisherId = "com.coronalabs" }, --inapp purchase ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, --push notification --["plugin.OneSignal"] = --{ -- publisherId = "com.onesignal", --}, --local notification ["plugin.notifications"] = { publisherId = "com.coronalabs" }, ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, iphone = { plist = { CFBundleDisplayName = "Corecraft", CFBundleName = "Corecraft", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, UILaunchImages = {}, --required UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, MinimumOSVersion = "6.0", --CoronaLabs NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, NSLocationAlwaysUsageDescription = { "" }, NSLocationWhenInUseUsageDescription = { "" }, }, }, --orientation = --{ default = "portrait", --supported = --{ -- "landscapeLeft", "landscapeRight", "portrait", "portraitUpsideDown", --}, --}, }

If you want to check your Samsung S6 with alternate code, I have a test app that I can send you. It’s a complied version of this code: https://github.com/animonger/corona-sdk-gpgs-tester

with the GPGS backend setup. If you are interested pm me your Google+ email so I can add you as a tester and send you a download link for the app.

Although I haven’t test the app on an S6 yet, I have tested it on several other android devices and it works fine.

Hi animonger,

thank you for your help! I made a Build of your gpgs-tester and installed it on my S6.

Same Problem as with my app… The login screen for gpgs pops up, but nothing happens after that. :frowning:

On my Android 4.4.2 device it works fine.

Does it really has to do something with Android 6.0.1?? There are games in the Corona showcase which also have gpgs and they work fine, so I guess the problem lies somwhere esle?

For any more suggestions i’m greatly thankful!

Android 6 uses a different permission system. You have to explicitly ask for permissions now when you need them. Look at the Camera sample app that we ship with the product and see how permissions are handled. You may have to ask for GPGS’s required permissions before you login.

Rob

Hi amplexor,

I’m currently running pure Android 6.0.1 on my Nexus 5 and GPGS works fine so I don’t think it’s all of Android 6.0.1.

Hopefully Rob’s suggestion works for you!

I’m not getting any further on this:

my build.settings -> usesPermission has the following settings:

            "android.permission.VIBRATE",             "android.permission.INTERNET",             "android.permission.WRITE\_EXTERNAL\_STORAGE",             "android.permission.ACCESS\_NETWORK\_STATE",             "android.permission.VIBRATE",             "android.permission.ACCESS\_FINE\_LOCATION",    --fetches location via GPS             "android.permission.ACCESS\_COARSE\_LOCATION",  --fetches location via WiFi or cellular service             "com.android.vending.BILLING",             "android.permission.RECEIVE\_BOOT\_COMPLETED",

using system.getInfo(“grantedAppPermissions”) I see I have even more permissions as it returns:

"android.permission.ACCESS\_FINE\_LOCATION" "android.permission.ACCESS\_NETWORK\_STATE" "com.android.vending.BILLING" "android.permission.WRITE\_EXTERNAL\_STORAGE" "android.permission.VIBRATE" "android.permission.WAKE\_LOCK" "android.permission.INTERNET" "android.permission.ACCESS\_COARSE\_LOCATION" "com.retroprinciples.corecraft.permission.C2D\_MESSAGE" "com.sec.android.provider.badge.permission.WRITE" "com.sec.android.provider.badge.permission.READ" "com.google.android.c2dm.permission.RECEIVE" "android.permission.RECEIVE\_BOOT\_COMPLETED" "android.permission.READ\_EXTERNAL\_STORAGE"

I programmed the following in order to get the permission:

local rationaleTitleMessage = "Persmission required" local permissionsToRequest = {  "android.permission.VIBRATE",                       "android.permission.INTERNET",                       "android.permission.WRITE\_EXTERNAL\_STORAGE",                       "android.permission.ACCESS\_NETWORK\_STATE",                       "android.permission.VIBRATE",                       "android.permission.ACCESS\_FINE\_LOCATION",                       "android.permission.ACCESS\_COARSE\_LOCATION",                       "com.android.vending.BILLING",                       "android.permission.RECEIVE\_BOOT\_COMPLETED"} local rationaleMessage = "android.permission.VIBRATE"..             "android.permission.INTERNET"..             "android.permission.WRITE\_EXTERNAL\_STORAGE"..             "android.permission.ACCESS\_NETWORK\_STATE"..             "android.permission.VIBRATE"..             "android.permission.ACCESS\_FINE\_LOCATION"..             "android.permission.ACCESS\_COARSE\_LOCATION"..             "com.android.vending.BILLING"..             "android.permission.RECEIVE\_BOOT\_COMPLETED" local function permissionsListener( event )   print( "permissionsListener( " .. json.prettify( event or {} ) .. " )" )   local grantedPermissions = system.getInfo("grantedAppPermissions")   print("grantedPermissions", inspect(grantedPermissions)) end   native.showPopup( "requestAppPermission", {       appPermission = permissionsToRequest,       urgency = "Normal",       rationaleTitle = rationaleTitleMessage,       rationaleDescription = rationaleMessage,       listener = permissionsListener,     } )

however I never get the popup. Instead the console says:

PermissionServices.ApiLevel23.requestPermissions(): All permissions that were requested have already been granted!

Still I’m unable to connect to google play services. I also do not get an error code.

The only information I can find on the console is:

GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

If you want to check your Samsung S6 with alternate code, I have a test app that I can send you. It’s a complied version of this code: https://github.com/animonger/corona-sdk-gpgs-tester

with the GPGS backend setup. If you are interested pm me your Google+ email so I can add you as a tester and send you a download link for the app.

Although I haven’t test the app on an S6 yet, I have tested it on several other android devices and it works fine.

Hi animonger,

thank you for your help! I made a Build of your gpgs-tester and installed it on my S6.

Same Problem as with my app… The login screen for gpgs pops up, but nothing happens after that. :frowning:

On my Android 4.4.2 device it works fine.

Does it really has to do something with Android 6.0.1?? There are games in the Corona showcase which also have gpgs and they work fine, so I guess the problem lies somwhere esle?

For any more suggestions i’m greatly thankful!

Android 6 uses a different permission system. You have to explicitly ask for permissions now when you need them. Look at the Camera sample app that we ship with the product and see how permissions are handled. You may have to ask for GPGS’s required permissions before you login.

Rob

Hi amplexor,

I’m currently running pure Android 6.0.1 on my Nexus 5 and GPGS works fine so I don’t think it’s all of Android 6.0.1.

Hopefully Rob’s suggestion works for you!

I’m not getting any further on this:

my build.settings -> usesPermission has the following settings:

            "android.permission.VIBRATE",             "android.permission.INTERNET",             "android.permission.WRITE\_EXTERNAL\_STORAGE",             "android.permission.ACCESS\_NETWORK\_STATE",             "android.permission.VIBRATE",             "android.permission.ACCESS\_FINE\_LOCATION",    --fetches location via GPS             "android.permission.ACCESS\_COARSE\_LOCATION",  --fetches location via WiFi or cellular service             "com.android.vending.BILLING",             "android.permission.RECEIVE\_BOOT\_COMPLETED",

using system.getInfo(“grantedAppPermissions”) I see I have even more permissions as it returns:

"android.permission.ACCESS\_FINE\_LOCATION" "android.permission.ACCESS\_NETWORK\_STATE" "com.android.vending.BILLING" "android.permission.WRITE\_EXTERNAL\_STORAGE" "android.permission.VIBRATE" "android.permission.WAKE\_LOCK" "android.permission.INTERNET" "android.permission.ACCESS\_COARSE\_LOCATION" "com.retroprinciples.corecraft.permission.C2D\_MESSAGE" "com.sec.android.provider.badge.permission.WRITE" "com.sec.android.provider.badge.permission.READ" "com.google.android.c2dm.permission.RECEIVE" "android.permission.RECEIVE\_BOOT\_COMPLETED" "android.permission.READ\_EXTERNAL\_STORAGE"

I programmed the following in order to get the permission:

local rationaleTitleMessage = "Persmission required" local permissionsToRequest = {  "android.permission.VIBRATE",                       "android.permission.INTERNET",                       "android.permission.WRITE\_EXTERNAL\_STORAGE",                       "android.permission.ACCESS\_NETWORK\_STATE",                       "android.permission.VIBRATE",                       "android.permission.ACCESS\_FINE\_LOCATION",                       "android.permission.ACCESS\_COARSE\_LOCATION",                       "com.android.vending.BILLING",                       "android.permission.RECEIVE\_BOOT\_COMPLETED"} local rationaleMessage = "android.permission.VIBRATE"..             "android.permission.INTERNET"..             "android.permission.WRITE\_EXTERNAL\_STORAGE"..             "android.permission.ACCESS\_NETWORK\_STATE"..             "android.permission.VIBRATE"..             "android.permission.ACCESS\_FINE\_LOCATION"..             "android.permission.ACCESS\_COARSE\_LOCATION"..             "com.android.vending.BILLING"..             "android.permission.RECEIVE\_BOOT\_COMPLETED" local function permissionsListener( event )   print( "permissionsListener( " .. json.prettify( event or {} ) .. " )" )   local grantedPermissions = system.getInfo("grantedAppPermissions")   print("grantedPermissions", inspect(grantedPermissions)) end   native.showPopup( "requestAppPermission", {       appPermission = permissionsToRequest,       urgency = "Normal",       rationaleTitle = rationaleTitleMessage,       rationaleDescription = rationaleMessage,       listener = permissionsListener,     } )

however I never get the popup. Instead the console says:

PermissionServices.ApiLevel23.requestPermissions(): All permissions that were requested have already been granted!

Still I’m unable to connect to google play services. I also do not get an error code.

The only information I can find on the console is:

GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.