here adb logcat from prev code

hi… i made a game by using gamenetwork to connect to game play android… but everytime i press the leader button or achievement button . its always closed the game n show up  ” unfortunately, project has stopped" ( project is my app name")…  anyone can help wut is wrong with the code… will be very thankful…

here is my code …

  1. – json = require(“json”)                          – used for file i/o
  2. lime = require(“lime”)                          – used for top 10 list manipulation
  3. local gameNetwork = require( “gameNetwork” )    – Google Play network
  4.  
  5. – Google Play Games leaderboard and achievements are referenced by ID’s. After defining these
  6. – on the Google Play Developer Console (http://play.google.com/apps/publish) , update them here
  7. local gpgLeaderBoardID = “CgkI8J_r9sMXXXXX”           – id for leaderboard (you can have several) 
  8. local gpgAchieve1ID = “CgkI8J_r9sXXXXXXX”           – id for perfect level 1 achievement
  9. local gpgAchieve2ID = “CgkI8J_r9sMXXXXXX”           – id for perfect level 2 achievement
  10. local gpgAchieve3ID = “CgkI8J_r9sMYXXXXX”           – id for perfect level 3 achievement
  11. local gpgAchieve4ID = “ACHIEVEMENT ID #4”           – id for perfect level 4 achievement
  12. local gpgAchieve5ID = “ACHIEVEMENT ID #5”  
  13.  
  14.  
  15. – Top 10 scores variables
  16. local topRank = {}                              – rank 1-10
  17. local topScore = {}                             – score
  18. local topName = {}                              – player’s name
  19. local topDate = {}                              – date score was recorded
  20.  
  21.  
  22. local function adListener( event )
  23. end
  24.  
  25. – Google Play Games has fetched the current player’s data.  
  26. local function loadLocalPlayerCallback( event )
  27.     – Let’s remember the player’s name for high score pre-loading
  28.    playerName = event.data.alias
  29. end
  30.  
  31. – Google Play Games network login events
  32. local function gameNetworkLoginCallback( event )
  33.     – request player data
  34.    gameNetwork.request( “loadLocalPlayer”, { listener=loadLocalPlayerCallback } )
  35.    return true
  36. end
  37.  
  38. – Google Play Games login initialize events
  39. local function gpgsInitCallback( event )
  40.     – request a login
  41.    gameNetwork.request( “login”, { userInitiated=true, listener=gameNetworkLoginCallback } )
  42. end
  43.  
  44. – process user prompt to login to Google Play Game services
  45. local function onClickGpLogin( event )
  46.     if “clicked” == event.action then
  47.         local i = event.index
  48.         – when i = 1, user is confirming a login prompt.
  49.         if i == 1 then gpgsInitCallback(nil) end
  50.     end
  51. end]
  52.  
  53. function setUpIntroScreen(myInt)
  54.  
  55.  
  56.     introScreenGroup = display.newGroup()             
  57.  
  58.     – position all of our graphics on the screen
  59.     local titleScreen = display.newImage(“main.jpg”,display.contentCenterX,display.contentCenterY)
  60.     local playButton = display.newImage(“start.png”,482,210)        – play button   
  61.     local helpButton = display.newImage(“rules.png”,615,210)        – rules/help button
  62.     local leaderButton = display.newImage(“leader.png”,433,340)     – Google Play Leaderboard button
  63.     local achieveButton = display.newImage(“achieve.png”,570,340)   – Google Play achievement button
  64.     local scoreButton = display.newImage(“scores.png”,705,340)      – local scores button
  65.  
  66.  
  67.     introScreenGroup:insert(leaderButton)
  68.     introScreenGroup:insert(achieveButton)
  69.  
  70.     – define what happens when the leaderboard button is tapped.

 leaderButton:addEventListener(“tap”,function ()

            if (gameNetwork.request(“isConnected”)) then                – has the user connected to Google Play Games?

print (“ayo main L”)

                   audio.play(soundEnemy4, {onComplete = function ()    – play a sound and when it’s done

                        gameNetwork.show( “leaderboards”  )             – display the leaderboard

                    end})

            else

print (“kenapa L”)

                – the user has not linked their account to the game, give them the option to do so. 

                native.showAlert (“Google+ required”, “You have not connected your Google+ account to this app”

                    , {“Connect Now”, “Cancel”}, onClickGpLogin)

            end

    end)

    – define what happens when the achievement button is tapped.

    achieveButton:addEventListener(“tap”,function ()                    

            if (gameNetwork.request(“isConnected”)) then  

print (“ayo main”)-- has the user connected to Google Play Games?

                audio.play(soundEnemy3, {onComplete = function ()       – play a sound and when it’s done

                        gameNetwork.show( “achievements”  )             – display the achievements

                    end})

            else

print (“kenapa?”)

                – the user has not linked their account to the game, give them the option to do so. 

                native.showAlert (“Google+ required”, “You have not connected your Google+ account to this app”

                    , {“Connect Now”, “Cancel”}, onClickGpLogin)

            end
72.     end)
73. end
74.  
75. function alert(myInt)
76.  
77.  if (gameNetwork.request(“isConnected”)) then                – is player connected to Google Play ?
78.             if (points > highScore) then                            – did player beat this session’s highest score?
79.                 – update leaderboard. ‘category’ = your Google Play leaderboard id
80.                 gameNetwork.request( “setHighScore”, {localPlayerScore={ category=gpgLeaderBoardID,value=tonumber(points)}})                           – 
81.                 highScore = points                                  – this will prevent future lower scores from wasting their
82.             end                                                     – attempting to update leaderboard
83.  
84.             – achievement checking. each request identifier = your Google Play achievement id
85.             – the achievedReached array tracks each unlocked achievemnt to prevent unlocking an achievement
86.             – which has already been unlocked in this session.
87.             if (achieveReached[1] == 0) and (perfectLevels[1]==1) then          – perfect level 1?
88.                 achieveReached[1] = 1
89.                 gameNetwork.request( “unlockAchievement”,                       – request an achievement unlock
90.                     {achievement = { identifier=gpgAchieve1ID,                  – id for perfect level 1 achievement
91.                     percentComplete=100, showsCompletionBanner=true }} )
92.             end
93.             if (achieveReached[2] == 0) and (perfectLevels[2]==1) then          – perfect level 2?
94.                 achieveReached[2] = 1
95.                 gameNetwork.request( “unlockAchievement”,                       – request an achievement unlock
96.                     {achievement = { identifier=gpgAchieve2ID,                  – id for perfect level 2 achievement
97.                     percentComplete=100, showsCompletionBanner=true }} )
98.             end
99.             if (achieveReached[3] == 0) and (perfectLevels[3]==1) then          – perfect level 3?            
100.                 achieveReached[3] = 1
101.                 gameNetwork.request( “unlockAchievement”,                       – request an achievement unlock
102.                     {achievement = { identifier=gpgAchieve3ID,                  – id for perfect level 3 achievement
103.                     percentComplete=100, showsCompletionBanner=true }} )
104.             end
105.             if (achieveReached[4] == 0) and (perfectLevels[4]==1) then          – perfect level 4?
106.                 achieveReached[4] = 1
107.                 gameNetwork.request( “unlockAchievement”,                       – request an achievement unlock
108.                     {achievement = { identifier=gpgAchieve4ID,                  – id for perfect level 4 achievement
109.                     percentComplete=100, showsCompletionBanner=true }} )
110.             end
111.             if (achieveReached[5] == 0) and (points>=700) then                  – exceeded 700 points?
112.                 achieveReached[5] = 1                                           
113.                 gameNetwork.request( “unlockAchievement”,                       – request an achievement unlock
114.                     {achievement = { identifier=gpgAchieve5ID,                  – id for exceeded threshold achievement
115.                     percentComplete=100, showsCompletionBanner=true }} )
116.             end
117.         end
118. end
119.  
120. gameNetwork.init( “google”, gpgsInitCallback)

 

everything good… just only leaderboard n achievement… when i pressed it, it always closed the game …

here is my build.settings

 

 

  1. – -- Supported values for orientation:
  2. – portrait, portraitUpsideDown, landscapeLeft, landscapeRight
  3.  
  4. settings = {
  5.  
  6. orientation = {
  7. default = “landscapeRight”,
  8. supported = { “landscapeRight”, }
  9. },
  10. plugins =    {
  11.         – key is the name passed to Lua’s ‘require()’
  12.         [“plugin.google.play.services”] =
  13.         {
  14.             – required
  15.             publisherId = “com.coronalabs”,
  16.         },
  17.  
  18.         [“CoronaProvider.gameNetwork.google”] =
  19.         {
  20.             --required!
  21.             publisherId = “com.coronalabs”,
  22.         },
  23.         [“facebook”] =
  24.         {
  25.             publisherId = “com.coronalabs”
  26.         },
  27.     }, 
  28. iphone = {
  29. plist = {
  30. UIStatusBarHidden = false,
  31. UIPrerenderedIcon = true, – set to false for “shine” overlay
  32. –UIApplicationExitsOnSuspend = true, – uncomment to quit app on suspend
  33.  
  34.             --[[
  35.             – iOS app URL schemes:
  36.             CFBundleURLTypes =
  37.             {
  38.                 {
  39.                     CFBundleURLSchemes =
  40.                     {
  41.                         “fbXXXXXXXXXXXXXX”, – example scheme for facebook
  42.                         “coronasdkapp”, – example second scheme
  43.                     }
  44.                 }
  45.             }
  46.             --]]
  47. }
  48. },
  49.  
  50. –[[
  51. – Android permissions
  52.  
  53. androidPermissions = {
  54.   “android.permission.INTERNET”,
  55.   },
  56.  
  57. ]]–
  58.  
  59. android = {
  60.         googlePlayGamesAppId = “84286811XXX”  --long App ID number (use yours!)
  61.     },
  62. }

anyone can help???

I realized from my older post that I am using a different plugin than what you are using. This is what I have in my build settings:

["plugin.gpgs"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true} },

Then to call the leaderboard:

gpgs = require( “plugin.gpgs” )

gpgs.show( “leaderboards” )

I think you are using the really old plugin. I can’t find the documentation on the site. If you switch the newer one maybe more people will be able to help you.

thank you for reply…

i was changes everything with gpgs… n using plugin.gpgs n still not working… leaderboard show nothing… i dont know wut is wrong…  adb show there is not error… :((( 

Your “adb logcat” is filtering out everything but messages from the Corona activity. When you’re talking to GPGS, or anything that happens id a different activity, you can’t filter on just Corona messages.  Please run it just like this:

adb logcat

without any other parameters. It’s going to dump a lot of non-relevant text at you. But you will have to search for messages coming from Google Play.

Please make sure you read and follow the various login and submission logic used in this tutorial:

https://docs.coronalabs.com/tutorial/games/gameLeaderboards/index.html

Rob

thank you guys for gimme idea…

i found out… it was on my sha1 fingerprint… :)))))))))))))

now everything works well…

awesome. good news.

Great!

Rob

here is my build.settings

 

 

  1. – -- Supported values for orientation:
  2. – portrait, portraitUpsideDown, landscapeLeft, landscapeRight
  3.  
  4. settings = {
  5.  
  6. orientation = {
  7. default = “landscapeRight”,
  8. supported = { “landscapeRight”, }
  9. },
  10. plugins =    {
  11.         – key is the name passed to Lua’s ‘require()’
  12.         [“plugin.google.play.services”] =
  13.         {
  14.             – required
  15.             publisherId = “com.coronalabs”,
  16.         },
  17.  
  18.         [“CoronaProvider.gameNetwork.google”] =
  19.         {
  20.             --required!
  21.             publisherId = “com.coronalabs”,
  22.         },
  23.         [“facebook”] =
  24.         {
  25.             publisherId = “com.coronalabs”
  26.         },
  27.     }, 
  28. iphone = {
  29. plist = {
  30. UIStatusBarHidden = false,
  31. UIPrerenderedIcon = true, – set to false for “shine” overlay
  32. –UIApplicationExitsOnSuspend = true, – uncomment to quit app on suspend
  33.  
  34.             --[[
  35.             – iOS app URL schemes:
  36.             CFBundleURLTypes =
  37.             {
  38.                 {
  39.                     CFBundleURLSchemes =
  40.                     {
  41.                         “fbXXXXXXXXXXXXXX”, – example scheme for facebook
  42.                         “coronasdkapp”, – example second scheme
  43.                     }
  44.                 }
  45.             }
  46.             --]]
  47. }
  48. },
  49.  
  50. –[[
  51. – Android permissions
  52.  
  53. androidPermissions = {
  54.   “android.permission.INTERNET”,
  55.   },
  56.  
  57. ]]–
  58.  
  59. android = {
  60.         googlePlayGamesAppId = “84286811XXX”  --long App ID number (use yours!)
  61.     },
  62. }

anyone can help???

I realized from my older post that I am using a different plugin than what you are using. This is what I have in my build settings:

["plugin.gpgs"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true} },

Then to call the leaderboard:

gpgs = require( “plugin.gpgs” )

gpgs.show( “leaderboards” )

I think you are using the really old plugin. I can’t find the documentation on the site. If you switch the newer one maybe more people will be able to help you.

thank you for reply…

i was changes everything with gpgs… n using plugin.gpgs n still not working… leaderboard show nothing… i dont know wut is wrong…  adb show there is not error… :((( 

Your “adb logcat” is filtering out everything but messages from the Corona activity. When you’re talking to GPGS, or anything that happens id a different activity, you can’t filter on just Corona messages.  Please run it just like this:

adb logcat

without any other parameters. It’s going to dump a lot of non-relevant text at you. But you will have to search for messages coming from Google Play.

Please make sure you read and follow the various login and submission logic used in this tutorial:

https://docs.coronalabs.com/tutorial/games/gameLeaderboards/index.html

Rob

thank you guys for gimme idea…

i found out… it was on my sha1 fingerprint… :)))))))))))))

now everything works well…

awesome. good news.

Great!

Rob