Posts

Showing posts with the label Facebook

Android App - Adding A "share" Button To Share The App On Social Networks

Answer : Solution 1: Launch ACTION_SEND Intent When launching a SEND intent, you should usually wrap it in a chooser (through createChooser(Intent, CharSequence)), which will give the proper interface for the user to pick how to send your data and allow you to specify a prompt indicating what they are doing. Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); # change the type of data you need to share, # for image use "image/*" intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, URL_TO_SHARE); startActivity(Intent.createChooser(intent, "Share")); Solution 2: Use ShareActionProvider If you are just looking to add a Share button in Overflow Menu, also have a look at ShareActionProvider. public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.share, menu); MenuItem item = menu.findItem(R.id.share_item); actionProvider = (ShareActionProvider) item.getActionProvider(); // Cre...

Add Custom Name, Caption, Image, Description To New Facebook Share Dialog Or Custom Stories Not Taking Them From Og Meta

Answer : Update on 2019. This method is not working any more. New solution has not been find yet. :( Update on 27.06.2018. Old version of the code stopped working properly. The shared image was displayed as small image on the left, instead of as large full column image. The fix is to replace action_type: 'og.shares' with action_type: 'og.likes' . Use this code: FB.ui({ method: 'share_open_graph', action_type: 'og.likes', action_properties: JSON.stringify({ object: { 'og:url': url, 'og:title': title, 'og:description': des, 'og:image': img } }) }, function (response) { // Action after response }); This works with API version 2.9+ . Please note that using og.shares action_type , is not advised any more since it is not mentioned in the FB documentation and it doesn't properly display the large image. I now use og.likes . The...

Authenticate User Using Omniauth And Facebook For A Rails API?

Answer : the best way I found (after being stuck for a while on this issue ) is to do your omniauth2 (specifically in my case using satellizer angular plugin) manually... I'll discuss the solution for Facebook as it was my case, but everything could apply to any other provider. first you have to know how omniauth2 works (as documented for humans here)... Client: Open a popup window for user to authenticate. Client: Sign in (if necessary), then authorize the application. Client: After successful authorization, the popup is redirected back to your app. with the code (authorization code) query string parameter the redirect back url must match your front-end app url not the back-end url and it must be specified in your facebook app configurations Client: The code parameter is sent back to the parent window that opened the popup. Client: Parent window closes the popup and sends a POST request to backend/auth/facebook with code parameter. Server: code ( A...