Facebook SDK iOS share photo ( FBSDKSharePhotoContent ) can not share applink - xcode

I'm trying to share a photo using FBSDKSharePhotoContent and make the applink works but I bang my head to make it works.
My app is mobile only so the photos are not hosted on any web site.
I use this code to share the photo:
let photo = FBSDKSharePhoto()
photo.image = currentHeaderImage
photo.userGenerated = false
let photoContent = FBSDKSharePhotoContent()
photoContent.photos = [photo]
photoContent.hashtag = FBSDKHashtag(string: "#Showflix")
photoContent.contentURL = NSURL(string: "applink...")
FBSDKShareDialog.showFromViewController(self, withContent: photoContent, delegate: nil)
I generated the applink using the Facebook Developer site interface.
The photo is corretly published on Facebook but there are no link in the post. If I click on the photo it only open a normal photo on facebook.
I tried also using photo.imageUrl, I tried also FBSDKShareDialog without success.
All I need is to share a photo on Facebook user wall and if someone clicks on this photo it should propose to open it in the mobile app.
Thanks for help

Related

How to use Google Picker with Google Drive using flutter

I can't find any resource to embed google Picker in a flutter to upload a doc to Google drive. Can any provide me with an example of how to integrate Google Picker to Flutter?
Same issue here, you can use file_picker:
final result = await FilePicker.platform.pickFiles();
It will navigate user to an UI for selecting files including other app's files, i.e. google drive.
BTW, you should request permissions before picking the file:
final googleSignIn = GoogleSignIn(scopes: []);
await googleSignIn.signIn()
// request when you need it!
await googleSignIn.requestScopes([SheetsApi.spreadsheetsScope])
Found similar question here: File Picker for Google Drive Rest API for Android

Open Native iOS app from Xamarin.Forms

I have an native iOS sample app installed in my iPad and also my sample xamarin.Forms App installed. I want to open native iOS app from Xamarin.forms when clicked on button. I have set URL schema in my native iOS app in info.plist.
How do I open native app from xamarin.forms on click of a button. I already tried
var request = Device.OnPlatform(
string.Format("native app url"),
string.Format("native app url"),
string.Format("native app url"));
Device.OpenUri(new Uri(request));
but its not working.
It's basically how you are doing it.
var url = Device.OnPlatform(iOSUrl, androidUrl, winPhoneUrl);
Device.OpenUri(new Uri(request));
Be aware that each platform have some requirements in the way to url is configured and parameters are sent.
Let say to get the maps app open in each platform you would use these urls schemes:
// iOS doesn't like %s or spaces in their URLs, so manually replace spaces with +s
var iOSUrl = string.Format("http://maps.apple.com/maps?q={0}&sll={1}", name.Replace(' ', '+'), loc);
var androidUrl = string.Format("geo:0,0?q={0}({1})", string.IsNullOrWhiteSpace(addr) ? loc : addr, name);
var winPhoneUrl = $"bingmaps:?cp={loc}&q={name}";
var url = Device.OnPlatform(iOSUrl, androidUrl, winPhoneUrl);
Also you cannot open any arbitrary app unless you know its Url scheme.
Anyway, if the Device.OpenUri() doesn't fulfill your requirements you are good to create your own implementations using the native APIs.
Please go through the below link and attached photo
Link:-launch-an-app-from-within-another-iphone
I am using below code in xamarin forms
NSUrl request = new NSUrl("Camera://");
var canOpen = UIApplication.SharedApplication.CanOpenUrl(new NSUrl(request.ToString()));
if (!canOpen)
{ Task.FromResult(false); }
else
{
Task.FromResult(UIApplication.SharedApplication.OpenUrl(new NSUrl(request.ToString())));
}

How to access a Google Photos shared album

I posted this as an answer to a related question but it was deleted by a moderator, so I'm posting this now as a question. The related question is
Accessing shared albums from Google Photos
I am trying to access a Google Photos shared album using JavaScript. Public albums created with Picasa are easier to deal with using the Picasa Web Albums Data API.
I've developed a peculiar solution parsing the HTML contents of a shared album URL, such as
https://photos.google.com/share/<album>?key=<key>
The parsing function is
function getgooglephotos2(result)
{
var r2 = result.substr(result.search("AF_initDataCallback\\("));
var r3 = r2.substr(0, r2.search("https://video"));
var img = r3.search("https:");
while (img != -1) {
var r4 = r3.substr(img);
var imgend = r4.search("\"");
var r5 = r4.substr(0, imgend);
// r5 contains an image url
r3 = r4.substr(imgend);
img = r3.search("https:");
}
}
I would prefer a cleaner approach. Any idea?
Thanks.
PS: it seems that using authentication, I can reach a Google Photos shared album, but I am trying to implement a solution that doesn't require authentication for shared (public) albums. Here's a link
https://adodson.com/hello.js/demos/albums.html
A simpler approach to test this is
Authenticate on picasa and fetch your userid
https://picasaweb.google.com
After authentication you will reach
https://get.google.com/albumarchive/<userid>?source=pwa
Get your album list using the Picasa Web Albums Data API
https://picasaweb.google.com/data/feed/api/user/<userid>
I'm just developing app that doesn't require authentication. Anyway somehow you need to point out which album should be displaying. In my project I'm using Firebase to store URLs to shared albums. Then I request the URL and get photos using regex. To retrieve the photos I used this tutorial:
https://medium.com/#ValentinHervieu/how-i-used-google-photos-to-host-my-website-pictures-gallery-d49f037c8e3c
At the moment there is no way to access shared albums directly from Google Photos without authentication.

Attach image using Twitter Share link

Is it possible to attach an image to a tweet using the Twitter share link?
I'm using the following url to tweet but I can't find away to attach an image. The tweet has a link to the image but I want it attached to the tweet so someone can view the image while reading the tweet.
https://twitter.com/intent/tweet?hashtags=MyTag&url=http%3A%2F%2Ftest.com%2Fimage.png
Or would have to use the twitter api?
I would recommend using https://tweetinvi.codeplex.com/documentation which you can programmer directly with twitter.
// Publish with media
byte[] file = File.ReadAllBytes(filePath);
var tweet = Tweet.CreateTweetWithMedia("I love tweetinvi", file);
var imageURL = tweet.Entities.Medias.First().MediaURL;
// Publish with geo information
var tweet = Tweet.CreateTweet("Hello guys");
tweet.PublishWithGeo(-54.73, -64.2);
// Retweet
tweet.PublishRetweet();
I do not believe it is possible to upload media through the share link. Probably, a security decision by Twitter.
I suggest you try the twitpic API.

facebook c# sdk how to post to user's wall as application from wp7

I'd like to know, how can I use facebook c# sdk to post to user's wall from my wp7 app as application.
So I want to display message from FB application on users wall.
I have so far:
var app = new FacebookApp();
var parameters = new Dictionary<string, object>
{
{"access_token", accessToken},
{"appId", appId,
{"message", "TEST"}
};
var fbCB = new FacebookAsyncCallback(postResult);
app.PostAsync("me/feed", parameters, fbCB);
But this displays text on my wall as I wrote it, not like the application specified by appId.
app.PostAsync("friendId/feed", parameters, fbCB);
I would also suggest you to use the latest facebook c# sdk.

Resources