Social sharing options


#1

Hi,
In my game, I implemented a icon for invite facebook friends. I used sdkbox, with the method: sdkbox::PluginFacebook::inviteFriends(app_link_url, link_image). Works perfect, the problem is that Facebook team has announced that the AppLinks (fb.me) is deprecated and it will be supported until February 5, 2018. So, I should to re-evaluate what method of social sharing I should to use in my App.

Talking with @yinjimmy , he propused me integrate Facebook Invites manually: https://developers.facebook.com/docs/applinks/hosting-api/ but It sounds like hard, I was very happy to use sdkbox::PluginFacebook::inviteFriends because it was very easy to implement.

I read that sdkbox has a special plugin for social sharing: http://docs.sdkbox.com/en/plugins/share/v3-cpp/ but it includes only Facebook, Twitter and SMS.

I’m not interested sharing with Twitter and SMS. And If I wanted to use Facebook Share, I implemented sdkbox facebook in my App.

What’s about Whatsapp? SDKBox is thinking to include it? Anyone has implemented it manually? It’s possible? And what’s about Facebook Invites? SDKBox will update for it?


#2
  1. get token from https://developers.facebook.com/tools/access_token/

  2. create link host

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="iOS App Link Object Example" \
-F ios=' [
    {
      "url" : "sharesample://story/1234",
      "app_store_id" : 12345,
      "app_name" : "ShareSample",
    },
  ]' \
-F web=' {
    "should_fallback" : false,
  }'

and u will get a link, such as:

{"id":"611591085677879"}
  1. queary link
curl -G https://graph.facebook.com/611591085677879 \
-d access_token="APP_ACCESS_TOKEN" \
-d fields=canonical_url \
-d pretty=true
#
{
   "canonical_url": "https://fb.me/611591085677879",
   "id": "611591085677879"
}

or

curl -G https://graph.facebook.com \
-d access_token="APP_ACCESS_TOKEN" \
-d fields=app_links \
-d ids=https://fb.me/611591085677879 \
-d pretty=true
  1. update link host
curl https://graph.facebook.com/611591085677879 \
-F access_token="APP_ACCESS_TOKEN" \
-F name="FB App Link Object Example" \
-F ios=' [
    {
      "url" : "sharesample://story/1234",
      "app_store_id" : 12345,
      "app_name" : "ShareSample",
    },
  ]' \
-F web=' {
    "should_fallback" : false,
}'

#3

But if App Links Hosting is deprecated. Is convenient to use it?
Facebook will provides other method for invite friends, without app_link?
sdkbox provides facebook invites but it requiere app link.


#4

Someone tried to generate App Link URL manually with cURL?
I downloaded it from: https://curl.haxx.se/dlwiz/?type=bin&os=Win64 but I’ve some errors when I try to create link host.

Tried too, host my own file, but I can’t.
I created app_link.html and put this code:

<html>
<head>
    <meta property="al:ios:url" content="couchinapp://invite_from_fb?referral=123456789" />
    <meta property="al:ios:app_store_id" content="123456789" />
    <meta property="al:ios:app_name" content="Couchin'" />
    <meta property="al:android:url" content="couchinapp://invite_from_fb?referral=123456789" />
    <meta property="al:android:app_name" content="Couchin" />
    <meta property="al:android:package" content="com.mycompany.couchin" />
    <meta property="al:web:url" content="http://www.couchinapp.com/myapp.html" />
</head>
<body>
Couchin App Link
</body>
</html>

As Facebook mentioned here: https://developers.facebook.com/docs/app-invites/android#app_links

And I changed the data.
I upload the html in my hosting and I called the URL in sdkbox::PluginFacebook::inviteFriends
But when I try to invite some people, this is the msg:

Captura

Missing App Link URL.

All this would be easier if Facebook had not put your URL generator offline: https://developers.facebook.com/quickstarts/?platform=app-links-host
:frowning:


#5

what errors ?


#6

Log:

C:\Tranthor\curl-7.56.1\I386>curl https://graph.facebook.com/app/app_link_hosts \ -F access_token="APP_TOKEN" \ -F name="APP_NAME" \ -F ios=' [{ "url" : "APP_NAME://", "app_name" : "APP_NAME", }, ]' \ -F web=' { "should_fallback" : false, }'
{"error":{"message":"(#100) Param ios must be a JSON-encoded string.","type":"OAuthException","code":100,"fbtrace_id":"Ea7+fQ7It2D"}}curl: (6) Could not resolve host: \
curl: (6) Could not resolve host: \
curl: (6) Could not resolve host: \
curl: (3) [globbing] bad range specification in column 2
curl: (6) Could not resolve host: url
curl: (3) Bad URL, colon is first character
curl: (1) Protocol "APP_NAME" not supported or disabled in libcurl
curl: (6) Could not resolve host: app_name
curl: (3) Bad URL, colon is first character
curl: (6) Could not resolve host: APP_NAME,
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (6) Could not resolve host: \
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: should_fallback
curl: (3) Bad URL, colon is first character
curl: (6) Could not resolve host: false,
curl: (3) [globbing] unmatched close brace/bracket in column 1

C:\Tranthor\curl-7.56.1\I386>

I replaced:
APP_TOKEN: With the app token from here: https://developers.facebook.com/tools/access_token/
APP_NAME: With the name of the app.

My OS is Windows10 (64).
I downloaded curl from: https://curl.haxx.se/dlwiz/?type=bin&os=Win64


#7

command is invalid.
put it in bat file ? I cant try the command in windows system, cause I dont have a windows system.
Sorry.


#8

Ok finally I solved the problem including native sharing in iOS and Android.
I think is better because I have options to share in SMS, Facebook, Whatsapp, Email, etc. Is very global.

How to include it in iOS:

How to include it in Android:
Put this in AppActivity.java (or make a method) with this code:

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setAction(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Share text");
Cocos2dxActivity.getContext().startActivity(Intent.createChooser(sharingIntent,"Share title"));

@yinjimmy evaluate it for sdkbox, would be fantastic if all this could be done in c++, without touching code in Java and Objetive-C.

Thanks


#9

we also have a share plugin for system share.

http://docs.sdkbox.com/en/plugins/share/v3-cpp/#native-share

sdkbox::SocialShareInfo info;
info.text = "#sdkbox(www.sdkbox.com) - the cure for sdk fatigue ";
info.title = "sdkbox";
//info.image = "path/to/image"
info.link = "http://www.sdkbox.com";
sdkbox::PluginShare::nativeShare(info);

// the follow property will be ignored in nativeShare
//info.showDialog = false;
//info.platform = sdkbox::SocialPlatform::Platform_Select;

sdkbox::PluginShare::nativeShare(info);

But your issue here is about the fb app link.