[SOLVED] Facebook: Help with App Link URL

I am trying to add a Facebook invite friends feature as in the sample

http://docs.sdkbox.com/en/plugins/facebook/v3-cpp/

void HelloWorld::onInviteFriends(cocos2d::Ref* sender )
{
PluginFacebook::inviteFriends(“https://fb.me/322164761287181”,
http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png”);
}

The first parameter is an URL named App Link URL, that can be either

  1. hosted by Facebook, following instructions from

https://developers.facebook.com/quickstarts/?platform=app-links-host

  1. hosted by us on a site following this format

https://developers.facebook.com/docs/app-invites/android?locale=it_IT#app_links

I tried 1),

and entered for this part

URL with custom scheme
A url with a custom scheme that will open your app. For more information, see the iOS developer documentation. This is a required field if you have an iOS app.

the string

“wordbuild://open”

and using the generated link in the form of
https://fb.me/322164761287181
for first parameter of the function

The Facebook invitation goes out with success, but my friends do not actually receive any invitation

Regarding 2)
Can anyone post any pointers of how to define this item, “al:ios:url”

an example
meta property=“al:ios:url” content=“couchinapp://invite_from_fb?referral=123456789”

Hello @PedroVicente

Have you added Facebook Canvas support to your facebook app.
If that’s not added then you won’t be able to get notifications in your web browser, it would only come to your android/iOS application.

So, it’s like you are sending app invites and they will get into their apps only not in browser.
We have some discussions about this topic in the forums.

Please check these threads -

http://discuss.cocos2d-x.org/t/fb-invite-links-host/25931

http://discuss.cocos2d-x.org/t/solved-sdkbox-facebook-invitefriends-not-working/25007

Best,
Pabitra

We have managed to setup this part with SDKBOX, you can check functionality in our game Infinity Loop: Blueprints https://itunes.apple.com/us/app/infinity-loop-blueprints/id1049688084?mt=8

You should click on pause - o - icon in right top corner and select on left top corner Pen symbol, you will be navigated to level creator. Login to facebook,create new level-> you will get invite friend button. Hope you will find it:D

Thanks for the reply
Yes, I had seen those posts before. In my case it does not even work for iOS: I send the friend invite from my iOS device, my friend has a iOS device with the Facebook app, he does not receive a request.

I did try to add a Canvas support for the app, but the invite request also does not show in a web browser

@energyy
Good to know that is working for you. I did try your app. Interesting puzzle. However, I do not see any way to get any option or a menu. It just keeps me asking for more puzzle levels :smile:

@pabitrapadhy

Here is my code flow and debug messages I get

I do all SDKBOX calls in a layer class

bool layer_start_t::init()
{
  if (!LayerColor::init())
  {
    return false;
  }
#ifdef SDKBOX_ENABLED
  sdkbox::PluginFacebook::setListener(this);
  sdkbox::PluginFacebook::init();
  if (sdkbox::PluginFacebook::isLoggedIn())
  {
    checkFaceBookStatus();
  }
#endif

After this code the output is

No application token, skip remote config processApplied config '{"ios":{"Facebook":{"debug":"true"},"iap":{"items":{"word_build_word_size":{"id":"word_build_word_size_01","type":"non_consumable"}}}}}'2016-01-29 23:48:54.125 wordbuild iOS[2523:682821] Reachability Flag Status: -R ------- networkStatusForFlags
##FB isLogin: 1, msg: autologin
2016-01-29 23:48:54.133 wordbuild iOS[2523:682821] Reachability Flag Status: -R ------- networkStatusForFlags
##FB> permission list: 
##FB>> permission manage_pages
##FB>> permission user_about_me
##FB>> permission user_friends
##FB>> permission publish_pages
##FB>> permission publish_actions
##FB>> permission public_profile
##FB> user id: 814566625252793
##FB> FBSDK version: 4.7.0
Frame size: 750 1334
Visible size: 750 1334
Design resolution size: 652 1160
2016-01-29 23:48:54.322 wordbuild iOS[2523:682821] FBSDKLog: FBSDKTimeSpentData Restore: {"numInterruptions":4,"lastSuspendTime":1454132894,"secondsSpentInCurrentSession":170}
2016-01-29 23:48:54.323 wordbuild iOS[2523:682821] FBSDKLog: FBSDKAppEvents Persist: Read 0 event states. First state has 0 events
2016-01-29 23:48:54.323 wordbuild iOS[2523:682821] FBSDKLog: FBSDKAppEvents Persist: Clearing
2016-01-29 23:48:54.331 wordbuild iOS[2523:682821] cocos2d: surface size: 750x1334
2016-01-29 23:48:54.658 wordbuild iOS[2523:682821] FBSDKLog: The field 'email' is only accessible on the User object after the user grants the 'email' permission.
Facebook id:'814566625252793' name:'Pedro Vicente' last_name:'Pedro' first_name:'Vicente' email:'' installed:'0'

then the invite call

void layer_start_t::menu_facebook_invite(Ref* pSender)
{
#ifdef SDKBOX_ENABLED  
  if (sdkbox::PluginFacebook::isLoggedIn())
  {
    
  }
  else
  {
    sdkbox::PluginFacebook::login();
    fb_login = true;
  }

  sdkbox::PluginFacebook::inviteFriends(
  "https://fb.me/1149198138426264", //made with wordbuild://
  "http://www.space-research.org/games/wordbuild/word_build_tablet.png");

#endif

and output

offestY = 0.000000
offestY = 0.000000
offestY = 0.000000
offestY = 0.000000
2016-01-29 23:53:54.830 wordbuild iOS[2523:682821] FBSDKLog: FBSDKAppEvents: Flushed @ 1454133234, 1 events due to 'Timer' - {
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZF823A8DD-59CC-4629-803C-FD1FC22B1225";
    "application_tracking_enabled" = 1;
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"org.space-research.wordy\",\"1\",\"4\",\"9.2.1\",\"iPhone7,2\",\"en_US\",\"CST\",\"AT&T\",375,667,\"2.00\",2,12,7]";
    "url_schemes" = "[\"fb908618432484237\",\"fbauth2\",\"wordbuild\"]";
}
Events: [
  {
    "event" : {
      "_eventName" : "fb_app_invite_share_show",
      "_logTime" : 1454133225,
      "_implicitlyLogged" : "1",
      "_ui" : "no_ui"
    },
    "isImplicit" : true
  }
]
Flush Result : Success
offestY = 0.000000
offestY = 0.000000
offestY = 0.000000
offestY = 0.000000
2016-01-29 23:54:00.195 wordbuild iOS[2523:682821] FBSDKLog: FBSDKAppEvents Persist: Writing 0 events
2016-01-29 23:54:00.206 wordbuild iOS[2523:682821] FBSDKLog: FBSDKTimeSpentData Persist: {"numInterruptions":5,"lastSuspendTime":1454133240,"secondsSpentInCurrentSession":476}
on invite friends ok= ''
2016-01-29 23:54:00.245 wordbuild iOS[2523:682821] FBSDKLog: FBSDKTimeSpentData Restore: {"numInterruptions":5,"lastSuspendTime":1454133240,"secondsSpentInCurrentSession":476}
2016-01-29 23:54:09.771 wordbuild iOS[2523:682821] FBSDKLog: FBSDKAppEvents: Flushed @ 1454133249, 1 events due to 'Timer' - {
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZF823A8DD-59CC-4629-803C-FD1FC22B1225";
    "application_tracking_enabled" = 1;
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"org.space-research.wordy\",\"1\",\"4\",\"9.2.1\",\"iPhone7,2\",\"en_US\",\"CST\",\"AT&T\",375,667,\"2.00\",2,12,7]";
    "url_schemes" = "[\"fb908618432484237\",\"fbauth2\",\"wordbuild\"]";
}
Events: [
  {
    "event" : {
      "_ui" : "FBSDKContainerViewController",
      "_eventName" : "fb_app_invite_dialog_share_result",
      "_logTime" : 1454133240,
      "fb_dialog_outcome" : "Completed",
      "_implicitlyLogged" : "1"
    },
    "isImplicit" : true
  }
]
Flush Result : Success

Info.plist changes to support App Link URL and Facebook

<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>fb908618432484237</string>
				<string>fbauth2</string>
			</array>
		</dict>
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>CFBundleURLName</key>
			<string>org.research.space</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>wordbuild</string>
			</array>
		</dict>
	</array>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>FacebookAppID</key>
	<string>908618432484237</string>
	<key>FacebookDisplayName</key>
	<string>WordBuild</string>
	<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>fbapi</string>
		<string>fb-messenger-api</string>
		<string>fbauth2</string>
		<string>fbshareextension</string>
	</array>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>
	<key>UIPrerenderedIcon</key>
	<true/>
	<key>UIRequiresFullScreen</key>
	<true/>

Is is possible to get some information from the output debug messages?

@energyy
Is it possible for you to post here the steps you did to get the Facebook invite working?

As I understand your code works, just no one receiving invite(app not crashing).

  1. Check which platforms you configured in Facebook developer if IOS and Android only, then your invite will be visible only in Facebook application not site on friend devices. Also it depenends if you have published or not your facebook app and your friend is in developers list.

During gameplay check for small circle in top right corner, it is menu button:)

AH, my friends were not in the TESTERS list ; so I added them, now they got the invite.

THANK YOU :smile:

1 Like

And check the invitation link with Facebook App on Device (iOS/Android)