ok so i cn log in just one time then it freeze again after i log out or cancel the login
build setting.
[lua]
-----build setting-------------
settings =
{
orientation =
{
default = “landscapeRight”, supported =
{
“landscapeRight”,“landscapeLeft”
},
},
android =
{
googlePlayGamesAppId = “XXXXXXXX”,
usesPermissions =
{
“android.permission.INTERNET”,
},
},
plugins =
{
[“facebook”] =
{
– required
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone = true, [“iphone-sim”] = true },
},
},
plugins =
{
– key is the name passed to Lua’s ‘require()’
[“CoronaProvider.gameNetwork.google”] =
{
--required!
publisherId = “com.coronalabs”,
supportedPlatforms = { android = true }
},
},
}
[/lua]
so the fcb_leaderboard is a scrollview in wich i will add scores of friends after the log in and the facebookconnect integer is to see if user logged in so it will be saved as 1 so each time the app start it will log in to Facebook automatically
[lua]
------------code—
local facebook = require( “facebook” )
local json = require( “json” )
local fbCommand = nil
local appId = “XXXXX”
function changemenu3()
facebookconnect = 1
local facebookconnectFilename = “facebookconnect.data”
saveValue(facebookconnectFilename, tostring(facebookconnect) )
connect_fcb.y = 100
connect_fcb:prepare(“disconnect”)
connect_fcb:play()
fcb_leaderboard.x = 132
cb_leaderboard.y = 270
end
function facebookListener(event)
print( “Facebook Listener events:” )
–
if ( “session” == event.type ) then
– event.phase is one of: “login”, “loginFailed”, “loginCancelled”, “logout”
– statusMessage.textObject.text = event.phase – tjn Added
print( "Session Status: " … event.phase )
if event.phase == “login” then
if(facebookconnect==0)then
changemenu3()
end
end
if event.phase == “logout” then
end
if event.phase == “loginFailed” then
function cancelfcbalert(event)
if(event.action==“clicked”)then
if(event.index == 1)then
native.cancelAlert( alert )
end
end
alert = native.showAlert( “”, “Facebook login error. Check connection or try again later.”, { “Done” }, cancelfcbalert )
end
end
– The following displays a Facebook dialog box for posting to your Facebook Wall
elseif ( “request” == event.type ) then
local response = event.response
elseif ( “dialog” == event.type ) then
end
end
function connect_tofcb(event)
if(event.phase==“began” and gamestart==false)then
if(facebookconnect==0)then
facebook.login( “XXXXXXXXX”, facebookListener , { “public_profile”,“user_friends” } )
else
function areyousurefcb( event )
if(event.action==“clicked”)then
if(event.index==1)then
facebook.logout( )
facebookconnect = 0
local facebookconnectFilename = “facebookconnect.data”
saveValue(facebookconnectFilename, tostring(facebookconnect) )
connect_fcb.y = 250
connect_fcb:prepare(“connect”)
connect_fcb:play()
fcb_leaderboard.x = 132
fcb_leaderboard.y = 2000
else
native.cancelAlert( alert )
end
end
end
alert = native.showAlert( “”, “Are you sure you want to disconnect from this Facebook account?”, { “Yes”, “No” }, areyousurefcb )
end
end
end
connect_fcb:addEventListener(“touch”, connect_tofcb )
[/lua]
please help