Plugin.FacebookKit.Core
10.0.80
dotnet add package Plugin.FacebookKit.Core --version 10.0.80
NuGet\Install-Package Plugin.FacebookKit.Core -Version 10.0.80
<PackageReference Include="Plugin.FacebookKit.Core" Version="10.0.80" />
<PackageVersion Include="Plugin.FacebookKit.Core" Version="10.0.80" />
<PackageReference Include="Plugin.FacebookKit.Core" />
paket add Plugin.FacebookKit.Core --version 10.0.80
#r "nuget: Plugin.FacebookKit.Core, 10.0.80"
#:package Plugin.FacebookKit.Core@10.0.80
#addin nuget:?package=Plugin.FacebookKit.Core&version=10.0.80
#tool nuget:?package=Plugin.FacebookKit.Core&version=10.0.80
Plugin.FacebookKit
This is a wrapper library around the native Android and iOS Facebook SDKs which includes cross-platform APIs for Authentication and Sharing with Facebook Login and Facebook Sharing.
Supported Features
| Feature | Plugin | Platforms |
|---|---|---|
| Core | Plugin.FacebookKit.Core | Android, iOS, MacCatalyst |
| Login | Plugin.FacebookKit.Login | Android, iOS, MacCatalyst |
| Share | Plugin.FacebookKit.Share | Android, iOS, MacCatalyst |
| [Plugin] | Plugin.FacebookKit | Android, iOS, MacCatalyst |
Nuget Packages
Versions of these packages and android dependencies have been chosen to align transitively with dotnet maui versions. For instance, selecting version 10.0.80 will align android transitive depencies with the same ones used with .NET Maui Version 10.0.80. Transitive dependencies can always be locked by adding package references to the project.
| Package | Version |
|---|---|
| Plugin.FacebookKit | |
| Plugin.FacebookKit.Core | |
| Plugin.FacebookKit.Login | |
| Plugin.FacebookKit.Share |
Installing a package
The easiest way to install a package on Windows platforms is through Visual Studio Nuget package manager. InstallNuget
The easiest way to install a package on Mac platform is add it using the terminal. Windows users can also do this too using the dotnet command line interface. InstallNuget
dotnet package add Plugin.FacebookKit
Visual studio can resolve the dependency automatically by adding the package reference directly to the .csproj file with the following text
<ItemGroup>
<PackageReference Include="Plugin.FacebookKit" Version="10.0.80" />
</ItemGroup>
Intro
This a custom cross platform implementation of binding packages that bind the native SDK's to C#. The information below shows developers the original SDK intent and how they were meant to be used. When reviewing app behavior, developers should always refer to the official Facebook docs. Follow the steps here to get started.
- Register with Meta as a developer.
- Create an app.
- (Optional) Select use cases such as authentication and access profile information. Customize.
- Implement facebook app project Id's, client tokens, and protocols into the AndroidManifest.xml and Info.plist files. See the sample/FacebookSample project or the following quickstart guides for additional setup details:
iOS Dependencies
| Package | Version |
|---|---|
| plugin.Facebook.iOS.AEM | |
| plugin.Facebook.iOS.Core | |
| plugin.Facebook.iOS.CoreBasics | |
| plugin.Facebook.iOS.GamingServices | |
| plugin.Facebook.iOS.Login | |
| plugin.Facebook.iOS.Share |
Android Dependencies
Project Configuration
This plugin currently doesn't support windows, the project is set up such that developers can call "FacebookPluginLogin.Current" without crashing. Instead any calls on windows will throw, catch, and log "NotImplementedException" on windows and return a null value. Just null check the implementation before making calls to windows.
Be sure to change the TargetFramework this project uses (net10.0-*)
If using the native Facebook Button Controls is desired, they can be loaded by calling ".UseFacebookControls" in the MauiProgram.cs like this:
using Plugin.FacebookKit;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
return MauiApp
.CreateBuilder()
.UseMauiApp<App>()
...
.UseFacebookControls()
.Build();
}
}
Windows specifics (Not Implemented)
Calling the implementation instance on Windows
NOTE: Windows is not implemented. This plugin does not crash production Apps when deploying to Windows but calls to the implementation on Windows will throw a NullReferenceException. When deploying to Windows, Calls to implementations should be null checked like this:
var dialog = FacebookPluginShare.Current?.CreateShareDialog();
var loginManager = FacebookPluginLogin.Current?.CreateLoginManager();
Android specifics
To receive callbacks from the native Facebook SDK, register the callback manager.
protected override void OnActivityResult(int requestCode, Result resultCode, Intent? data)
{
base.OnActivityResult(requestCode, resultCode, data);
FacebookMainActivity.CallbackManager.OnActivityResult(requestCode, (int)resultCode, data);
}
(Login Only) Call initialize in the MainActivity.cs by overriding OnCreate
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
FacebookPluginLogin.Initialize();
}
Ensure the ApplicationId in the .csproj file matches the bundle_id and package_name inside of the [Info.plist|AndroidManifest.xml] files:
<ApplicationId>com.example.myapp</ApplicationId>
Facebook requires adding the HashKey to the project App for testing purposes prior to publishing. To generate the HashKey, it can be computed on AppStart by implementing this in the MainActivity.cs by overriding OnCreate like this:
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
PrintFacebookKeyHash();
}
private void PrintFacebookKeyHash()
{
try
{
var packageInfo = PackageManager!.GetPackageInfo(PackageName!, Android.Content.PM.PackageInfoFlags.SigningCertificates);
var signingInfo = packageInfo.SigningInfo;
if (signingInfo is null)
{
Android.Util.Log.Debug("Facebook", "SigningInfo is null.");
Console.WriteLine("Facebook", "SigningInfo is null.");
Debug.WriteLine("Facebook", "SigningInfo is null.");
return;
}
var signatures = signingInfo.HasMultipleSigners ? signingInfo.GetApkContentsSigners() : signingInfo.GetSigningCertificateHistory();
foreach (var signature in signatures!)
{
using var sha1 = MessageDigest.GetInstance("SHA");
sha1.Update(signature.ToByteArray());
var hash = Android.Util.Base64.EncodeToString(sha1.Digest()!, Android.Util.Base64Flags.NoWrap);
Android.Util.Log.Debug("Facebook", $"Key Hash: {hash}");
Console.WriteLine($"Facebook HashKey: {hash}");
Debug.WriteLine($"Facebook HashKey: {hash}");
}
}
catch (Exception ex)
{
Android.Util.Log.Error("Facebook", $"Failed to get key hash: {ex}");
Console.WriteLine($"Facebook Failed to get key hash: {ex}");
Debug.WriteLine($"Facebook Failed to get key hash: {ex}");
}
}
iOS specifics
To intialize Facebook SDK and get callbacks from the native Facebook SDK, register the SDK's AppDelegate. If using Login, call initialize here.
using Foundation;
using UIKit;
using Plugin.FacebookKit.Core;
namespace ShareMauiSample;
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
public override bool FinishedLaunching(UIApplication application, NSDictionary? launchOptions)
{
FacebookPluginLogin.Initialize();
FacebookApplicationDelegate.DidFinishLaunching(application, launchOptions);
return base.FinishedLaunching(application, launchOptions);;
}
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
return FacebookApplicationDelegate.OpenUrl(app, url, options);
}
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
{
FacebookApplicationDelegate.Application(application, userActivity);
return base.ContinueUserActivity(application, userActivity, completionHandler);
}
public override void OnActivated(UIApplication application)
{
FacebookApplicationDelegate.ActivateApp();
base.OnActivated(application);
}
}
Documentation and samples
See the docs for more details on feature implementation.
In the samples folder there are two sample projects, one for sharing and one for login. Though there is no combinded sample, if using both features, developers can simply use [Plugin.FacebookKit] and for controls in the MauiAppBuilder <c>.UseFacebookControls()</c>
To run the sample successfully, ensure to update the Info.plist, Entitlements.plist, String.xml, AndroidManifest.xml files to match the app project information in your facebook app project.
License
The license developers are required to accept is a standard MIT license located here: License.md
Release notes
Version 10.0.80
- Initial release.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. net10.0-ios26.0 is compatible. net10.0-maccatalyst26.0 is compatible. net10.0-windows10.0.19041 is compatible. |
-
net10.0-android36.0
- plugin.Facebook.Android.Core (>= 10.0.80)
-
net10.0-ios26.0
- plugin.Facebook.iOS.Core (>= 10.0.80)
-
net10.0-maccatalyst26.0
- plugin.Facebook.iOS.Core (>= 10.0.80)
-
net10.0-windows10.0.19041
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Plugin.FacebookKit.Core:
| Package | Downloads |
|---|---|
|
Plugin.FacebookKit.Share
The maui nuget includes cross-platform APIs for Facebook Sharing. |
|
|
Plugin.FacebookKit
The maui nuget includes a package of Facebook APIs (Login and Share) |
|
|
Plugin.FacebookKit.Login
The maui nuget includes cross-platform APIs for Facebook Login. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.80 | 44 | 9/3/2026 |