Facebook Invite Friends

Heres what i got from another forum and research but it still does not work…It pops up facebook ask to login facebook i do it then nothing happens

local function facebookListener( event )
if ( “session” == event.type ) then
– upon successful login, request list of friends of the signed in user
if ( “login” == event.phase ) then
inviteText.text = “Pulling friend list…”

local params = {
app_id = “503058703136644”,
message = “Try this! Test 123”
}
facebook.showDialog(“apprequests”, params)

local access_token = event.token
print( access_token )
end
elseif ( “request” == event.type ) then
– event.response is a JSON object from the FB server
local response = event.response

elseif ( “dialog” == event.type ) then
print ( “event type:” , event.type)
print( “event name:” , event.name)
print ( “event data:”, event.data)
print( "event response: ", event.response)

end
end

facebook.login( “503058703136644”, facebookListener, { “user_friends”, “email” } )

What does your build.settings look like?

Rob

What does your build.settings look like?

Rob

hi Rob my build setting is like this

settings =
{
  plugins = {
 
    [“plugin.google.play.services”] =
     {
        publisherId = “com.coronalabs”,
     },
     [“plugin.adbuddiz”] = { publisherId = “com.adbuddiz” },
    
  --[[remove this line to implement AdMob
    [“CoronaProvider.ads.admob”] =
     {
       publisherId = “com.coronalabs”,
      },
    ]] --remove this line to implement AdMob
  },
    orientation =
    {
        default = “portrait”,
        supported = { “portrait” }
    },
    android =
    {
    googlePlayGamesAppId = “xxxxxxxxxxxx”,  – app id number for google game services
        usesPermissions =
        {
            “android.permission.INTERNET”,
      “android.permission.ACCESS_NETWORK_STATE”,
     --[[remove this line if you use admob and not adbuddiz
      “android.permission.READ_PHONE_STATE”
      ]]–remove this line if you use admob and not adbuddiz
        },
    },
    iphone =
    {
        plist =
        {
            CFBundleIconFile = “Icon.png”,
            CFBundleIconFiles =
            {
                “Icon.png”,
                “Icon@2x.png”,
                “Icon-60.png”,
                “Icon-60@2x.png”,
                “Icon-72.png”,
                “Icon-72@2x.png”,
                “Icon-76.png”,
                “Icon-76@2x.png”,
                “Icon-Small.png”,
                “Icon-Small@2x.png”,
                “Icon-Small-40.png”,
                “Icon-Small-40@2x.png”,
                “Icon-Small-50.png”,
                “Icon-Small-50@2x.png”,
            },
            UIApplicationExitsOnSuspend = false,  – false for single sign-on to work
            
            FacebookAppID = “xxxxxxxxxxxxx”,    – facebook appId

            CFBundleURLTypes =
            {
                {
                    CFBundleURLSchemes =
                    {
                        “fbxxxxxxxxxxxx”,    –  facebook appId,             
                    }
                }
            }
        }
    }
}
 

can this make my app post score on facebook?

main.lua has the following

local networksLib = require “networksLib”;
local storyboard = require “storyboard”;
storyboard.purgeOnSceneChange = true;

_G.twitterConsumerKey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
_G.twitterSecretKey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
_G.facebookAPPID = “xxxxxxxxxxxxxx”;
_G.facebookSecretKey = “xxxxxxxxxxxxxxxxxxxxxx”
_G.socialShareMessage = "I just got to totalPoints on Super Gogo™! ";
 

If you want to use facebook you have two choices:

  1. Use the facebook plugin

  2. Use the social plugin (Android) or activity plugin (iOS)

#2 is way simpler to implement.  See:

https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/index.html

https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_activity/index.html

If you choose to go with #1, then you need to read out Facebook guides:

https://docs.coronalabs.com/guide/index.html#communication-social

There are two you need to read.

Rob

Hey Rob,

I am trying to login via facebook but getting error “invalid key hash”. I have generated  my hash key and filled in facebook developer app and tested so many times with no luck. But when i uninstalled my native app from device, It’s working fine. Is there anything wrong with facebook login?

I am using  corona build 2647 and testing on android kitat(4.4)

Can you post the contents of your “adb logcat” console log?  Please do not filter just on Corona messages.  That is just type “adb logcat” and no other parameters.

Rob

hi Rob my build setting is like this

settings =
{
  plugins = {
 
    [“plugin.google.play.services”] =
     {
        publisherId = “com.coronalabs”,
     },
     [“plugin.adbuddiz”] = { publisherId = “com.adbuddiz” },
    
  --[[remove this line to implement AdMob
    [“CoronaProvider.ads.admob”] =
     {
       publisherId = “com.coronalabs”,
      },
    ]] --remove this line to implement AdMob
  },
    orientation =
    {
        default = “portrait”,
        supported = { “portrait” }
    },
    android =
    {
    googlePlayGamesAppId = “xxxxxxxxxxxx”,  – app id number for google game services
        usesPermissions =
        {
            “android.permission.INTERNET”,
      “android.permission.ACCESS_NETWORK_STATE”,
     --[[remove this line if you use admob and not adbuddiz
      “android.permission.READ_PHONE_STATE”
      ]]–remove this line if you use admob and not adbuddiz
        },
    },
    iphone =
    {
        plist =
        {
            CFBundleIconFile = “Icon.png”,
            CFBundleIconFiles =
            {
                “Icon.png”,
                “Icon@2x.png”,
                “Icon-60.png”,
                “Icon-60@2x.png”,
                “Icon-72.png”,
                “Icon-72@2x.png”,
                “Icon-76.png”,
                “Icon-76@2x.png”,
                “Icon-Small.png”,
                “Icon-Small@2x.png”,
                “Icon-Small-40.png”,
                “Icon-Small-40@2x.png”,
                “Icon-Small-50.png”,
                “Icon-Small-50@2x.png”,
            },
            UIApplicationExitsOnSuspend = false,  – false for single sign-on to work
            
            FacebookAppID = “xxxxxxxxxxxxx”,    – facebook appId

            CFBundleURLTypes =
            {
                {
                    CFBundleURLSchemes =
                    {
                        “fbxxxxxxxxxxxx”,    –  facebook appId,             
                    }
                }
            }
        }
    }
}
 

can this make my app post score on facebook?

main.lua has the following

local networksLib = require “networksLib”;
local storyboard = require “storyboard”;
storyboard.purgeOnSceneChange = true;

_G.twitterConsumerKey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
_G.twitterSecretKey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
_G.facebookAPPID = “xxxxxxxxxxxxxx”;
_G.facebookSecretKey = “xxxxxxxxxxxxxxxxxxxxxx”
_G.socialShareMessage = "I just got to totalPoints on Super Gogo™! ";
 

If you want to use facebook you have two choices:

  1. Use the facebook plugin

  2. Use the social plugin (Android) or activity plugin (iOS)

#2 is way simpler to implement.  See:

https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/index.html

https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_activity/index.html

If you choose to go with #1, then you need to read out Facebook guides:

https://docs.coronalabs.com/guide/index.html#communication-social

There are two you need to read.

Rob

Hey Rob,

I am trying to login via facebook but getting error “invalid key hash”. I have generated  my hash key and filled in facebook developer app and tested so many times with no luck. But when i uninstalled my native app from device, It’s working fine. Is there anything wrong with facebook login?

I am using  corona build 2647 and testing on android kitat(4.4)

Can you post the contents of your “adb logcat” console log?  Please do not filter just on Corona messages.  That is just type “adb logcat” and no other parameters.

Rob