Facebook Login SDK Setup question

Hello! I’ve downloaded the code from “Facebook login using the Facebook SDK through foreign code” and I’ve got a MainView.ux setup. But I don’t know what function to call from the FacebookLogin.uno when a user clicks a login button.

Link to documentation: https://www.fusetools.com/docs/native-interop/facebook-login

My code looks like this:

<App>
	<DockPanel>
		<FacebookLogin ux:Global="FacebookLogin"/>
		<JavaScript>
			var FacebookLogin = require("FacebookLogin");

			function facebookButton_pressed() {
				FacebookLogin.Started();
			}

			module.exports = {
				facebookButton_pressed: facebookButton_pressed
			};
		</JavaScript>

		<StackPanel>
			<Button Text="Login To Facebook" Clicked="{facebookButton_pressed}" Padding="50"/>
		</StackPanel>
	</DockPanel>
</App>

What should I put under

function facebookButton_pressed(){
     FacebookLogin. ???????
}

I appreciate any help I can get! Thank you in advance!!

Hi Nixon,

if you take a look within the repository that holds the code in question, the answer lies right about here: https://github.com/fusetools/fuse-samples/blob/feature-NativeFacebookLogin/Samples/NativeFacebookLogin/MainView.ux#L5

Hope this helps!

OMG Thank you very much!!

Hi! I tried the sample code and it seems to compile without warning, but when i tried it on an Android device, i get this exception

Uno.Exception: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
   at Android.Base.JNI.TryGetException(Android.Base.Primitives.JNIEnvPtr,[string])
   at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr,[string])
   at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr)
   at FacebookLoginModule.FacebookLoginPromise.Login()
   at Fuse.UpdateListener.Invoke()
   at Fuse.UpdateManager.ProcessOnces(Fuse.Stage,Uno.Collections.List<Uno.Exception>&)
   at Fuse.UpdateManager.Update(Fuse.Stage)
   at Fuse.UpdateManager.ProcessStages()
   at Fuse.UpdateManager.Update()
   at Outracks.Simulator.Client.Application.OnUpdate()
   at Fuse.App.OnTick(object,Uno.Platform.TimerEventArgs)
   at Uno.Platform.Display.OnTick(Uno.Platform.TimerEventArgs)
   at Uno.Platform.AndroidDisplay.OnFrameCallback(double,double)

I get this error even with the sample project.

On iOS it works ok. Any ideas?

Hi John,

please post this on a new forum thread (the question in this one was resolved), and include all details about Fuse version, OS you are on, the devices you are testing this with etc.

A minimal project that reproduces the issue would be very welcome too.