I've implemented the SharePlugin in my Xamarin.Forms project.
This works fine, but I meet a little "problem" on iOS: when I share a link, I haven't the choice to post it on Facebook:
This option doesn't seem to be avalaible in the Activities list:
On Android, the Facebook option is well available:
However, if I use the SharePlugin sample, the "Facebook" option is well available on iOS and in the activities:
I share the link like this:
private void OnShareIconClicked(object sender, EventArgs e)
{
if (!CrossShare.IsSupported)
return;
CrossShare.Current.Share(new Plugin.Share.Abstractions.ShareMessage
{
Title = "MyApp",
Text = _vm.AgendaEvent.encart_titre,
Url = _vm.AgendaEvent.infos_url
});
}
Would you have any explanation?
Add the following line to FinishedLaunching in AppDelegate.cs:
Plugin.Share.ShareImplementation.ExcludedUIActivityTypes.Clear();
It will clear the ExcludedUIActivityTypes list. Then Facebook extension will show.
Related
I develop a game with unity3d, I've integrated facebook's unity3d-SDK.
At login, I used
public void LoginFB()
{
var perms = new List<string>() { "public_profile", "email","user_friends"};
FB.LogInWithReadPermissions(perms, AuthCallback);
}
But when I take a screenshot to post to facebook using :
FB.API("me/photos", HttpMethod.POST, ScreenshotSharePostCallBack, wwwForm);
The callback result said : 403 forbidden.
So I want to update the Permissions, but I have no idea about how to update it.
when I added the follow on the share button
FB.LogInWithPublishPermissions(new List<string>() { "publish_actions" }, callback : PublishActionsDone);
the app crashed.
Please tell me how to update the permissions when user click the button of sharing ,and how to open share dialog when using FB.API(.....).
Thanks !
This doens't work anymore. You have to use FB.ShareLink() now. which doesn't require any permission like "publish_actions" anymore. This now what Facebook prefers. BTW I forgot to mention you have to build it in order for it to work and see the results. :D
https://developers.facebook.com/docs/unity/reference/current/FB.ShareLink
I share an content of page, like image and text and it's work fine.
But i try ti share link for when someone click, navigate to a my UWP in a page of content shared before.
Like "Click here": this have a link to navigate for my app installed in uwp.
For navigate to my page I need to pass parameters, such as:
((App)(App.Current)).NavigationService.Navigate<MyPage>(Parameters.ToString());
I dont have any idea to do this. :(
someone help me please?
Thanks
If I understand you correctly; you want to supply a link which will open your UWP app and open a "previously shared" page.
To be able to do this you'll need to register to handle uri activation. You'll have to register a protocoll for your app, for example myawesomeapp:.
Then you can pass some additional parameters when someone click the link: myawsomeapp://navto=sharehistory&showitem=2.
Lastly your apps need to handle when it's launched from a uri in OnActivated:
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Protocol)
{
ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
// TODO: Handle URI activation
// The received URI is eventArgs.Uri.AbsoluteUri
}
}
You can read the docs here
I am working on a hybrid mobile app using ionic and cordova, In the app I am sharing pictures with comments in social media. I want to impliment "facebook feed" method to share pictures in facebook with custom comments.
I have tried ngCordova's Facebook plugin but I faced some Issues in that, where the issue ticket is still open in the plugin builder's github. So I removed this plugin.
I have seen ngOpenFB but there I have'nt found $openFB.ui() method for feed dialog.
I want to know that is there any plugin available by which I can impliment Facebook feed for image sharing in my app.
Thanks in advance.
Please have a look for your facebook integration in your hybrid app nicraboy
// Add to openfb.js and use it.
function ui(method,obj) {
var method = method || 'GET',
params = obj || {},
xhr = new XMLHttpRequest(),
url;
params['access_token'] = tokenStore.fbAccessToken;
params['redirect_uri'] = 'http://localhost:8100/#/tab/chats';
params['display'] = 'popup';
params['sdk'] = 'joey';
params['app_id'] = 'APP Id in Integer';
url = 'https://www.facebook.com/v2.6/dialog/' + method + '?' + toQueryString(params);
window.open(url, '_open', 'location=no,clearcache=no');
//window.open(url, '_self', 'location=no,clearcache=no');
}
Also have a look at this repo: https://github.com/srameshr/ionic-starter-oauth
I just installed the new version of Unity 4.3 and the new facebook sdk and I can't get it working.
I created the app on facebook, copied over the app id to the unity facebook settings as required and copied the Package Name and Class name back to facebook.
Because the Android Key Hash is empty ( even it shouldn't be ) I used the methods posted by others to create one with openssl. I created it and copied over to facebook as required.
After this I created a small script to be able to login.
// Use this for initialization
void Start () {
enabled = false;
FB.Init(SetInit, OnHideUnity);
}
// Update is called once per frame
void Update () {
}
private void SetInit()
{
FbDebug.Log("SetInit");
enabled = true; // "enabled" is a property inherited from MonoBehaviour
if (FB.IsLoggedIn)
{
FbDebug.Log("Already logged in");
OnLoggedIn();
}
}
private void OnHideUnity(bool isGameShown)
{
FbDebug.Log("OnHideUnity");
if (!isGameShown)
{
// pause the game - we will need to hide
Time.timeScale = 0;
}
else
{
// start the game back up - we're getting focus again
Time.timeScale = 1;
}
}
void OnGUI(){
if (!FB.IsLoggedIn)
{
if (GUI.Button(new Rect(179 , 11, 287, 160), "Login to Facebook"))
{
FB.Login("email", LoginCallback);
}
}
}
void LoginCallback(FBResult result)
{
FbDebug.Log("LoginCallback");
Debug.Log("LoginCallback");
if (FB.IsLoggedIn)
{
OnLoggedIn();
}
}
void OnLoggedIn()
{
FbDebug.Log("Logged in. ID: " + FB.UserId);
}
Now when I click on the login button a Facebook window appears requesting permission, after I press ok, it returns, but I'm still not logged in... Can anybody help why is this?
Another strange thing I observed that the LoginCallback gets called as soon as I click on the login button, even though I would think it should only when I gave permission. Anyway when I give permission it returns to my app and nothing happens. I can click on the login button again and same thing happens, login callback called, it asks for permisions, I give the permision and returns back, nothing happened. Can anybody help?
Version 4.3.6 of the sdk should fix this problem. It's available here: https://developers.facebook.com/ We are still waiting for it to be approved on the asset store, so the only place to get it right now is from Facebook's site.
Note - it's still broken (5/2014) IF you use a Mac. Just follow the "Rafael solution", discover your hash properly from public void OnLoginComplete(string message). Cheers
So after being frustrated for a few days with having to trace out the key to my phone, I decided to look into what it was doing.
After some research it turned out that when you published to an android device, facebook would use the keystore that was defined in your publish settings, not your .android/debug.keystore file. So I went in and changed the sdk to make it work the proper way. Essentially I changed the SDK to look at the ProjectSettings instead of the debug directory for grabbing the key hash. In the FacebookAndroidUtils.cs I added the following.
// Using the user defined keystore values instead of the debug one.
degbugKeyHash = GetKeyHash( PlayerSettings.Android.keyaliasName, PlayerSettings.Android.keystoreName, PlayerSettings.Android.keyaliasPass, PlayerSettings.Android.keystorePass );
I created a small repo that provides the fix as well as some gui changes to make it more easy to update the key hash.
Github Facebook Unity SDK 6.1 Fix
Update - Fixed a bug with OS X related to escaping spaces on the string path
Hope this helps!
Take the "email" permission out of the login function and try it. Oops I thought I seen the "publish_actions" permission in there too.
Make sure the loginactivity in the manifest is in portrait.
Instead of implementing everything yourself, try using the free and open source SOOMLA Profile plugin for all of your social network needs:
https://github.com/soomla/unity3d-profile
Also available on the asset store for download:
https://www.assetstore.unity3d.com/en/#!/content/24601
It covers Facebook, Twitter and Google+ and has a unified API for logging in, posting statues, uploading images and getting friends lists. For proper disclosure, I'm one of the founders.
I'd like to allow my website (which allows users to post to the website itself, and, if the user enables it, Facebook) to be able to share a user's post to Google+. After reading through all I could find on stackoverflow/etc., it seems that the official G+ API doesn't allow you to post anything to a user's stream. That means that I'd have to use a share button/link/etc. The problem is, every share button/link I've found is for sharing _url_s...but I want to share text (and maybe an added URL if necessary)! If there's already a question answering this, sorry for reposting, but it must've gotten hidden beneath the ~ 5,000 questions that got returned for my search :D
Thanks,
Matthew
The Share API is intended for sharing pages, although you could share a page and have the Snippet data on that page contain the text that you want to share.
You may also want to look into the History API, which is currently in developer preview, to see if it will meet your needs or to provide feedback to Google about what changes you might need.
You may post a message like this..
whether G+ app is installed in your phone or not
try it, this works for me
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
shareMediaButton = (Button) findViewById(R.id.share_button);
shareMediaButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
if(isGooglePlusInstalled())
{
PlusShare.Builder share = new PlusShare.Builder(MainActivity.this);
share.setText("write your message here.....!");
//share.addStream(selectedImage);
share.setType("text/plain");
startActivityForResult(share.getIntent(), 0);
}else{
Intent shareIntent = new PlusShare.Builder(MainActivity.this)
.setType("text/plain")
.setText("write your message here.....!")
.getIntent();
startActivityForResult(shareIntent, 0);
}
}
public boolean isGooglePlusInstalled()
{
try
{
getPackageManager().getApplicationInfo("com.google.android.apps.plus", 0 );
return true;
}
catch(PackageManager.NameNotFoundException e)
{
return false;
}
}
});
}