tomgrill / gdx-facebook Goto Github PK
View Code? Open in Web Editor NEWlibGDX extension providing cross-platform support for Facebook Graph API.
License: Apache License 2.0
libGDX extension providing cross-platform support for Facebook Graph API.
License: Apache License 2.0
TODO add gamerequest support
09-07 06:41:12.806 2545-3491/com.sunraygames.oceanix W/dalvikvm﹕ threadid=20: thread exiting with uncaught exception (group=0xa4b7b648)
09-07 06:41:12.806 2545-3491/com.sunraygames.oceanix E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 207
java.lang.RuntimeException: GDXFacebookSystem has already been installed. You may not call install() more than once.
at de.tomgrill.gdxfacebook.core.GDXFacebookSystem.install(GDXFacebookSystem.java:66)
at com.sunraygames.oceanux.Game$1.(Game.java:82)
at com.sunraygames.oceanux.Game.create(Game.java:82)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
my code (error line):
facebook = GDXFacebookSystem.install(config);
This happens sometimes when you minimize an app and then try to return back. But between these moments the app should stay in background for a while and you can run other apps to force some memory cleaning.
hello Tom
I got the following exception while testing with my android 4.0.4 ice cream sandwich mobile phone.
When I test on Android 4.2 JellyBean and 6.0 marshmallow, I did not get any exception and it worked perfectly. Do you have any idea why it is crashing on Android 4.0.4?
E/gdx-facebook (1.1.1): Error installing gdx-facebook (1.1.1) for Android
E/gdx-facebook (1.1.1): Did you add >> compile "de.tomgrill.gdxfacebook:gdx-facebook-core:1.1.1" << to your gradle dependencies? View https://github.com/TomGrill/gdx-facebook/wiki for more information.
W/System.err: com.badlogic.gdx.utils.reflect.ReflectionException: Exception occurred in constructor for class: com.myproject.gdxfacebook.android.AndroidGDXFacebook
W/System.err: at com.badlogic.gdx.utils.reflect.Constructor.newInstance(Constructor.java:62)
W/System.err: at com.myproject.gdxfacebook.GDXFacebookSystem.tryToLoadAndroidGDXFacebook(GDXFacebookSystem.java:88)
W/System.err: at com.myproject.gdxfacebook.GDXFacebookSystem.installSystem(GDXFacebookSystem.java:35)
W/System.err: at com.myproject.gdxfacebook.GDXFacebookSystem.install(GDXFacebookSystem.java:26)
W/System.err: at com.myproject.FacebookManager.(FacebookManager.java:72)
W/System.err: at com.myproject.MyFirstGame.createFacebookManager(MyFirstGame.java:294)
W/System.err: at com.myproject.MyFirstGame.create(MyFirstGame.java:212)
W/System.err: at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
W/System.err: at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1456)
W/System.err: at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1217)
W/System.err: Caused by: java.lang.reflect.InvocationTargetException
W/System.err: at java.lang.reflect.Constructor.constructNative(Native Method)
W/System.err: at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
W/System.err: at com.badlogic.gdx.utils.reflect.Constructor.newInstance(Constructor.java:53)
W/System.err: ... 9 more
W/System.err: Caused by: java.lang.ExceptionInInitializerError
W/System.err: at com.facebook.FacebookSdk.getExecutor(FacebookSdk.java:378)
W/System.err: at com.facebook.internal.Utility.loadAppSettingsAsync(Utility.java:778)
W/System.err: at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:211)
W/System.err: at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:174)
W/System.err: at com.myproject.gdxfacebook.android.AndroidGDXFacebook.(AndroidGDXFacebook.java:38)
W/System.err: ... 12 more
W/System.err: Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
W/System.err: at android.os.Handler.(Handler.java:121)
W/System.err: at android.os.AsyncTask$InternalHandler.(AsyncTask.java:607)
W/System.err: at android.os.AsyncTask$InternalHandler.(AsyncTask.java:607)
W/System.err: at android.os.AsyncTask.(AsyncTask.java:190)
W/System.err: ... 17 more
This library requires that you call sign in everytime app is launched . Only then the access token is loaded or renewed . I think this causes problem in some cases such as mine where i show a login by facebook button to login but hide the button if the user is already logged in . The access token for native apps is managed by sdk and it has validity of 60 days if no call to the server is made . So it makes no sense to call signin everytime app is launched. When user app requires additional permission , he/she can call signin again . I think issignedIn method should check the local token and check if it is valid or not and return accordingly . The silent sign in ( check validity of existing token ) should be a public method as far as i understand .
I can make the changes but I am not sure whether i am thinking correctly . Am I thinking in the right direction or there is something i am missing ?
Seems closer to this issue
#38
Thanks
on Desktop:
token.getExpiresAt(): 1453044939
Converted: 1970-01-17T19:37:24.939Z (incorrect)
iOS, Android:
token.getExpiresAt(): 1453044940637
Converted: 2016-01-17T15:35:40.637Z (correct)
I have to manually multiply the value by 1000 to get the correct date. It looks like you get seconds instead on milliseconds on Desktop via getExpiresAt() method.
iOS, Android - OK.
Hello,
I'm trying to implement facebook and parse linking via parse REST api.
It requires to provide facebook access token expiration time.
Could you please add this value to your GDXFacebookLoginResult class?
I have integrated gdx-facebook in my libgdx project.
It is working fine in my android app but on iOS the app is crashing on start up with below exception.
2017-11-12 12:39:47.837453+0530 MY_APP[3408:173492] *** Terminating app due to uncaught exception 'java.lang.UnsatisfiedLinkError', reason: 'java.lang.UnsatisfiedLinkError: No implementation found for void com.badlogic.gdx.backends.iosrobovm.IOSGLES20.init() (tried Java_com_badlogic_gdx_backends_iosrobovm_IOSGLES20_init and Java_com_badlogic_gdx_backends_iosrobovm_IOSGLES20_init__)
at com.badlogic.gdx.backends.iosrobovm.IOSGLES20.init(Native Method)
at com.badlogic.gdx.backends.iosrobovm.IOSGLES20.<init>(IOSGLES20.java:28)
at com.badlogic.gdx.backends.iosmoe.IOSGraphics.init(IOSGraphics.java:125)
at com.badlogic.gdx.backends.iosmoe.IOSGraphics.init(IOSGraphics.java:195)
at com.badlogic.gdx.backends.iosmoe.IOSApplication.createGraphics(IOSApplication.java:193)
at com.badlogic.gdx.backends.iosmoe.IOSApplication.init(IOSApplication.java:176)
at com.badlogic.gdx.backends.iosmoe.IOSApplication.didFinishLaunching(IOSApplication.java:134)
at com.badlogic.gdx.backends.iosmoe.IOSApplication$Delegate.applicationDidFinishLaunchingWithOptions(IOSApplication.java:75)
at com.paxplay.MY_APP.IOSMoeLauncher.applicationDidFinishLaunchingWithOptions(IOSMoeLauncher.java:49)
at apple.uikit.c.UIKit.UIApplicationMain(Native Method)
at com.paxplay.MY_APP.IOSMoeLauncher.main(IOSMoeLauncher.java:31)
'
*** First throw call stack:
(
0 CoreFoundation 0x000000001789e1cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000017200f41 objc_exception_throw + 48
2 MOE 0x0000000012c51f05 _Z29hasObjCRuntimeBeenInitializedv + 0
3 MOE 0x0000000012c5772a _Z26nativeToJavaMessageHandlerP7ffi_cifPvPS1_S1_ + 1519
4 MOE 0x0000000012c5e629 ffi_closure_unix64_inner + 487
5 MOE 0x0000000012c5dbb2 ffi_closure_unix64 + 72
6 UIKit 0x0000000014a91db7 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4105
7 UIKit 0x0000000014a97245 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
8 UIKit 0x0000000014e52c6c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
9 UIKit 0x00000000152203ef +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
10 UIKit 0x0000000014e52865 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
11 UIKit 0x0000000014e530c3 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668
12 UIKit 0x00000000157b0c11 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
13 UIKit 0x00000000157b0aca -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
14 UIKit 0x000000001549eb9c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420
15 UIKit 0x0000000015699c3e _performActionsWithDelayForTransitionContext + 100
16 UIKit 0x000000001549e998 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
17 UIKit 0x000000001521fa4c -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
18 UIKit 0x0000000014a95ac6 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
19 UIKit 0x000000001505e523 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
20 FrontBoardServices 0x000000001ae78158 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
21 FrontBoardServices 0x000000001ae80c4d __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
22 libdispatch.dylib 0x0000000018f6b43c _dispatch_client_callout + 8
23 libdispatch.dylib 0x0000000018f70af4 _dispatch_block_invoke_direct + 592
24 FrontBoardServices 0x000000001aeac672 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
25 FrontBoardServices 0x000000001aeac328 -[FBSSerialQueue _performNext] + 464
26 FrontBoardServices 0x000000001aeac897 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
27 CoreFoundation 0x00000000178412b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
28 CoreFoundation 0x00000000178e0d31 __CFRunLoopDoSource0 + 81
29 CoreFoundation 0x0000000017825c19 __CFRunLoopDoSources0 + 185
30 CoreFoundation 0x00000000178251ff __CFRunLoopRun + 1279
31 CoreFoundation 0x0000000017824a89 CFRunLoopRunSpecific + 409
32 GraphicsServices 0x000000001b7859c6 GSEventRunModal + 62
33 UIKit 0x0000000014a98d30 UIApplicationMain + 159
34 MOE 0x0000000012c5da0d ffi_call_unix64 + 85
35 ??? 0x00007fff537b3650 0x0 + 140734593971792
)
libc++abi.dylib: terminating with uncaught exception of type ObjCException
In: de/tomgrill/gdxfacebook/core/GDXFacebookMultiPartRequest.java
[ERROR] Line 51: No source code is available for type java.io.FileInputStream; did you forget to inherit a required module?
[ERROR] Line 117: The method file() is undefined for the type FileHandle
[ERROR] Line 139: The method file() is undefined for the type FileHandle
Java.io is not supported by GWT, so maybe use @GwtIncompatible annotation for the loadFile method.
The second and third lines are using com.badlogic.gdx.files package - so need to get those to GWT.
In: de/tomgrill/gdxfacebook/core/utils/Utils.java
[ERROR] Line 46: No source code is available for type java.net.URL; did you forget to inherit a required module?
[ERROR] Line 72: No source code is available for type java.net.MalformedURLException; did you forget to inherit a required module?
[ERROR] Line 81: No source code is available for type java.net.URLDecoder; did you forget to inherit a required module?
URLDecoder is weird, cause I'm using URLEncoder in another part of my game, and it compiles in GWT perfectly,
Research: Is it possible to upload multiple images with a single POST request
Great work and very helpful project. But I found this bug when I try out the example at https://github.com/TomGrill/gdx-facebook-app.
In this example, I first login with read permission and it works correctly. But after that, when I try to login with publish permission, nothing happens. Testing was done on an Android device with NO Fackbook app installed. The read permission login was done through web interface.
After a little debugging, I found the issue in AndroidGDXFacebook.java. A logic error preventing the login() method correctly login publish permission when read permission is granted first. If you follow the execution of login() when you already have read permission, your AccessToken.getCurrentAccessToken will not be null, therefore line106 if clause will be false and you reach line116. Since you have read access token, line116 if clause will be true, then you enter the if clause and further down reach line120 "if (arePermissionsGranted(permissions))", but because this time you asking for publish permission which you don't have (you only have read permission), so this if clause will be false. After this false, the login method finished, you don't get the chance to run line159 LoginManager.getInstance().logInWithPublishPermissions(activity, permissions); Therefore you never get to longin with publish permission.
Please review the code and correct it if this is indeed not correct. Also make sure the app works when the gdx-facebook updated to later commit.
Thanks for any discussion.
Working well on android.
but
when make a graph request on desktop or iOS 10.1.1
stuck at
gdx-facebook (1.2.4): Loaded existing accessToken: EAABtt53dst8BAFej8ZCeZCbPAzc87A1TFUNVHMKtZANTZAvmWgpqI3ZBr1sChBKNMxrLYDi9qTX8N2Rr5XKuGgQWPhYelZBVHFwxRZANdMLzZB7umscOul0r4b87SBLYxnR7J8uCG7JR5CTdEJTSkvhyWVjaJcMcKIgZD
gdx-facebook (1.2.4): Starting silent sign in.
i was waiting for few minutes but nothing happen.
Please take a look.
Here is my code.
Login:
`public static void login(final GDXFacebook gdxFacebook, final XFBListener listener) {
Array permissions = new Array();
gdxFacebook.signIn(SignInMode.READ, permissions, new GDXFacebookCallback() {
@OverRide
public void onSuccess(SignInResult result) {
post(gdxFacebook);
listener.onSuccess();
}
@Override
public void onError(GDXFacebookError error) {
// Error handling
listener.onFailed();
}
@Override
public void onCancel() {
// When the user cancels the login process
listener.onFailed();
}
@Override
public void onFail(Throwable t) {
// When the login fails
listener.onFailed();
}
});
}`
`public static void post(final GDXFacebook gdxFacebook) {
GDXFacebookGraphRequest request = new GDXFacebookGraphRequest().setNode("xirtamgame/feed").useCurrentAccessToken();
request.setMethod(Net.HttpMethods.POST);
request.putField("link", "https://www.google.com");
request.putField("message", "message");
gdxFacebook.newGraphRequest(request, new GDXFacebookCallback<JsonResult>() {
@Override
public void onSuccess(JsonResult result) {
// Success
}
@Override
public void onError(GDXFacebookError error) {
// Error
}
@Override
public void onFail(Throwable t) {
// Fail
}
@Override
public void onCancel() {
// Cancel
}
});
}`
I got
"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200
I want only share a link,help plz.
You shouldn't force your users to include your sources in their GWT definition files like this:
<source path="de/tomgrill/gdxfacebook/core" />
<source path="de/tomgrill/gdxfacebook/html" />
Instead, you can create a GWT module that your users can simply inherit, similarly to how LibGDX libraries themselves are used:
<inherits name="com.badlogic.gdx.backends.gdx_backends_gwt" />
This way you have complete control over how your sources are included in GWT projects and you can exclude some problematic classes in the future without breaking existing applications, for example.
I have no idea how to send game request from app but i am trying as you specify on wiki but user didn't get any request from my app.
When I try to login on Facebook on desktop I get this error:
Exception in Application start method Exception in thread "Thread-2" java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoSuchMethodError: javafx.stage.Stage.setAlwaysOnTop(Z)V at de.tomgrill.gdxfacebook.desktop.JXBrowser.start(JXBrowser.java:97) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:219) at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:182) at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:179) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApplication.java:89) ... 1 more
This even happens on GdxFacebookSampleApp.
If I enable auto-login to call loginWithReadPermissions on app start, the " already authorized this app " poup confirmation dialog appears every time.
I guess you should just use the existing token instead of login again. I've noticed it is saved in the .session file on android. But It would be great to have proper auto-login handling inside your class.
libgdx 1.93 changes - verify/fix that extension works with MobiDevelop ios robovom
Hi
In my app, when I login to facebook, the access-token is saved and everything is fine. Silent-login works when I try to login again.
If I am in an active session where I recently entered my login and password, then when I try sending a game request with the game request dialog, it will show the persons available for invitation.
If on the other hand I have been logged in silently and try to send the same game request with the dialog, I am asked to re-enter my login and password, which is very strange, as I have already silently logged in.
Any explanation of this or just a "feature" (bug)?
Let me know if you need anything else from me.
Best regards,
Thomas
Hi, any idea why I'm getting this error now? Has worked fine before. Anything you've run into before?
[ERROR] ld: framework not found FBSDKShareKit
[ERROR] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] Couldn't compile app
org.apache.commons.exec.ExecuteException: Command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o "/Users/space/party_game/ios/robovm-build/tmp/Unnamed/ios/thumbv7/Space Pack" -arch armv7 -Wl,-filelist,/Users/space/party_game/ios/robovm-build/tmp/Unnamed/ios/thumbv7/objects0 -L /Users/space/.robovm-sdks/robovm-2.3.0/lib/vm/ios/thumbv7 -ObjC -Xlinker -alias_list -Xlinker /Users/space/party_game/ios/robovm-build/tmp/Unnamed/ios/thumbv7/aliased_symbols -exported_symbols_list /Users/space/party_game/ios/robovm-build/tmp/Unnamed/ios/thumbv7/exported_symbols -Wl,-no_implicit_dylibs -Wl,-dead_strip -F/Users/space/party_game/ios/libs -fPIC -miphoneos-version-min=8.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -lrobovm-bc -force_load /Users/space/.robovm-sdks/robovm-2.3.0/lib/vm/ios/thumbv7/librobovm-rt.a -lrobovm-debug -lrobovm-core -lgc -lpthread -ldl -lm -lz -liconv -lsqlite3 -framework Foundation -framework GoogleMobileAds -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CoreGraphics -framework CoreMedia -framework CoreMotion -framework CoreTelephony -framework CoreVideo -framework GLKit -framework MediaPlayer -framework MessageUI -framework OpenGLES -framework QuartzCore -framework SafariServices -framework StoreKit -framework SystemConfiguration -framework FBSDKShareKit -framework Bolts -framework FBSDKCoreKit -framework FBNotifications -framework ImageIO -framework UIKit -framework FBSDKLoginKit -framework FBSDKMessengerShareKit -framework OpenAL -force_load /Users/space/.robovm/cache/ios/thumbv7/release/Users/space/.gradle/caches/modules-2/files-2.1/com.mobidevelop.robovm/robopods-google-mobile-ads-ios/2.2.1/70c62b831c469d6517738b55a357ec66f1461720/robopods-google-mobile-ads-ios-2.2.1.jar.extracted/META-INF/robovm/ios/libs/libGGLAdMob.a -lz -force_load /Users/space/.robovm/cache/ios/thumbv7/release/Users/space/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-freetype-platform/1.9.5/2349dc0e71f911f0eff53c8e0cf3573701d62249/gdx-freetype-platform-1.9.5-natives-ios.jar.extracted/META-INF/robovm/ios/libs/libgdx-freetype.a -force_load /Users/space/.robovm/cache/ios/thumbv7/release/Users/space/.gradle/caches/modules-2/files-2.1/com.mobidevelop.robovm/robopods-google-apis-ios/2.2.1/200fc3ce120ac2a34d88fadf3e725cb15cacabc2/robopods-google-apis-ios-2.2.1.jar.extracted/META-INF/robovm/ios/libs/libGGLCore.a -force_load /Users/space/.robovm/cache/ios/thumbv7/release/Users/space/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-platform/1.9.5/80fed8c3dbf915df8e93c0ed8943e2e5e569e513/gdx-platform-1.9.5-natives-ios.jar.extracted/META-INF/robovm/ios/libs/libgdx.a -force_load /Users/space/.robovm/cache/ios/thumbv7/release/Users/space/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-platform/1.9.5/80fed8c3dbf915df8e93c0ed8943e2e5e569e513/gdx-platform-1.9.5-natives-ios.jar.extracted/META-INF/robovm/ios/libs/libObjectAL.a -framework MobileCoreServices -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks' failed (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:346)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
at org.robovm.compiler.util.Executor.exec(Executor.java:344)
at org.robovm.compiler.util.ToolchainUtil.link(ToolchainUtil.java:371)
at org.robovm.compiler.target.AbstractTarget.doBuild(AbstractTarget.java:269)
at org.robovm.compiler.target.ios.IOSTarget.doBuild(IOSTarget.java:327)
at org.robovm.compiler.target.AbstractTarget.build(AbstractTarget.java:263)
at org.robovm.compiler.Linker.link(Linker.java:421)
at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:467)
at org.robovm.compiler.AppCompiler.build(AppCompiler.java:776)
at org.robovm.idea.compilation.RoboVmCompilerThread.doCompile(RoboVmCompilerThread.java:60)
at org.robovm.idea.compilation.RoboVmCompilerThread.run(RoboVmCompilerThread.java:66)
Hi Tom,
Thanks very much for this extremely helpful project, it's made my life a lot easier while implementing FB oauth authentication.
There's a slight problem that popped up - I cannot seem to authenticate test users. Facebook Administrator level user logs in fine (tested on desktop and android) and gets an access token. Tester / test user will not - GDXFacebookCallback returns with:
public void onError(GDXFacebookError error) {
System.out.println("Facebook auth error: " + error.getErrorMessage() + " / " + error.getErrorCode() + ":" + error.getErrorSubCode() + ", error type: " + error.getErrorType());}
Login is done using the provided GDXFacebook.loginWithReadPermissions() method, permissions requested are email, public_profile, user_friends. Facebook app is in development status.
Is this a bug or expected behavior and I'm doing something wrong? I've read that debug access tokens require a different URL to validate, and also the exact opposite view that it should work just the same - so I'm confused.
Thanks,
SB.
Need to implement: https://developers.facebook.com/docs/games/mobile/ios-tutorial#requests_step3
And https://developers.facebook.com/docs/games/requests/v2.4 (Best practices)
I tried this on a project which I am building for all platforms, and all of them except the GWT are compiling just fine. I expected that it won't work for GWT, but I thought that it would at least compile. Are there any plans to make it work with GWT or at least provide placeholder classes so it would compile?
Otherwise, I'd have to make a wrapper for gdx-facebook, which seems kind of weird, as it is after all a library that's supposed to work with LibGDX and a pretty good one imho.
Hi,
Since I updated to 1.2.1 gdx-facebook cannot install on any of my iOS devices. It worked fine on my older version. Not sure if this is a known issue. I get the standard Error, asking if I've added gdx-facebook to my build.gradle file, which I have :)
My Android app crashes after trying to log in. Yesterday it was working fine. Today morning I noticed that I had lost my keystore file, so I had to change my package name. After this, logging in doesn't work anymore. Any help?
Log gives this output:
03-26 14:41:17.055 11888-11907/? D/gdx-facebook (1.1.1): Skip installing gdx-facebook (1.1.1) for Desktop. Not running Desktop.
03-26 14:41:17.060 11888-11907/? D/gdx-facebook (1.1.1): Skip installing gdx-facebook (1.1.1) for WebGL. Not running WebGL.
03-26 14:41:17.060 11888-11907/? D/gdx-facebook (1.1.1): Skip installing gdx-facebook (1.1.1) for iOS. Not running iOS.
03-26 14:41:17.060 11888-11907/? D/gdx-facebook (1.1.1): gdx-facebook (1.1.1) for Android installed successfully.
03-26 14:41:17.060 11888-11907/? D/gdx-facebook (1.1.1): Could not load existing accessToken
03-26 14:41:17.060 11888-11907/? D/gdx-facebook (1.1.1): Starting GUI sign in.
03-26 14:41:17.075 2418-3066/? E/Parcel: Class not found when unmarshalling: com.facebook.login.LoginClient$Request
and a bit later:
03-26 14:41:21.290 11953-11953/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.albertgronholm.kamalanew, PID: 11953
java.lang.RuntimeException: Unable to resume activity {com.albertgronholm.kamalanew/com.facebook.FacebookActivity}: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
Reproduced on Yosemite OS 10.10.5.
Steps to reproduce:
gdx-facebook: Skip installing gdx-facebook for Android. Not running Android.
gdx-facebook: Skip installing gdx-facebook for iOS. Not running iOS.
gdx-facebook: gdx-facebook for Desktop installed successfully.
2015-09-27 00:29:32.152 java[8639:250770] *** Assertion failure in -[NSMenu itemAtIndex:], /SourceCache/AppKit/AppKit-1348.17/Menus.subproj/NSMenu.m:893
2015-09-27 00:29:32.241 java[8639:250770] Invalid parameter not satisfying: (index >= 0) && (index < [_itemArray count])
2015-09-27 00:29:32.551 java[8639:250770] (
0 CoreFoundation 0x00007fff96f6003c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff908f676e objc_exception_throw + 43
2 CoreFoundation 0x00007fff96f5fe1a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff98b9799b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 AppKit 0x00007fff95241e41 -[NSMenu itemAtIndex:] + 164
5 AppKit 0x00007fff95235a90 -[NSApplication(NSWindowsMenu) setWindowsMenu:] + 218
6 libglass.dylib 0x00000001178bd7f1 -[GlassApplication runLoop:] + 1585
7 Foundation 0x00007fff98b61dd0 __NSThreadPerformPerform + 293
8 CoreFoundation 0x00007fff96e7ca01 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
9 CoreFoundation 0x00007fff96e6eb8d CFRunLoopDoSources0 + 269
10 CoreFoundation 0x00007fff96e6e1bf __CFRunLoopRun + 927
11 CoreFoundation 0x00007fff96e6dbd8 CFRunLoopRunSpecific + 296
12 HIToolbox 0x00007fff96b1656f RunCurrentEventLoopInMode + 235
13 HIToolbox 0x00007fff96b162ea ReceiveNextEventCommon + 431
14 HIToolbox 0x00007fff96b1612b _BlockUntilNextEventMatchingListInModeWithFilter + 71
15 AppKit 0x00007fff952488ab _DPSNextEvent + 978
16 AppKit 0x00007fff95247e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
17 libosxapp.dylib 0x000000010ef82b56 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
18 AppKit 0x00007fff9523daf3 -[NSApplication run] + 594
19 libosxapp.dylib 0x000000010ef829b9 +[NSApplicationAWT runAWTLoopWithApp:] + 156
20 liblwawt.dylib 0x000000010eedca5a -[AWTStarter starter:] + 1591
21 Foundation 0x00007fff98b61dd0 __NSThreadPerformPerform + 293
22 CoreFoundation 0x00007fff96e7ca01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
23 CoreFoundation 0x00007fff96e6eb8d __CFRunLoopDoSources0 + 269
24 CoreFoundation 0x00007fff96e6e1bf __CFRunLoopRun + 927
25 CoreFoundation 0x00007fff96e6dbd8 CFRunLoopRunSpecific + 296
26 java 0x00000001082ba4bc CreateExecutionEnvironment + 871
27 java 0x00000001082b4cac JLI_Launch + 1952
28 java 0x00000001082ba819 main + 101
29 java 0x00000001082b4504 start + 52
)
and nothing happens, i.e., a Facebook login window does not appear.
HI,
I got this working on Desktop and Android, but I'd love to also get it to work on GWT.
My game is cross platform, and allows direct cross platform play. And I've integrated Facebook login/register along side direct login/register to my site.
How do I make it work, the Facebook login, with HTML5?
Hi,
I use launch4j to produce an exe file from the desktop version of my app.
It works with openjdk 1.8.
When I try to log in to Facebook the app quits suddenly.
I found out which call caused the crash:
JXBrowser.login(permissions, config, this);
in startGUISignIn method
After some digging I think the problem can be the use of javafx in JXBrowser which is not part of openjdk.
Am I right? And can you propose me a workaround for this ?
Thank you.
I am not able to find a way in which I can create a ShareDialog of facebook using this library. Any help in this regard will be highly appreciated.
There is no way to silently check if user has already logged in before. SignIn loads the session and forces the user to log in. I can't forcefully check only facebook if i have a few logging in methods. Perhaps there is hidden loadSession() function somewhere?
As I mentioned in the LibGDX forum, I"m getting this error in my log when I sign in to the Facebook account in Android. (This is before the account grants permission to the app)
I/chromium﹕ [INFO:CONSOLE(1)] "Uncaught ReferenceError: require is not defined"
How I implemented the extension:
build.gradle
file.GDXFacebookConfig fbconfig = new GDXFacebookConfig();
fbconfig.PREF_FILENAME = ".facebookSessionData";
fbconfig.APP_ID = FB_APP_ID;
gdxFacebook = GDXFacebookSystem.install(fbconfig);
List<String> permissions = new ArrayList<String>();
permissions.add("email");
permissions.add("public_profile");
permissions.add("user_friends");
game.gdxFacebook.loginWithReadPermissions(permissions, new GDXFacebookCallback<GDXFacebookLoginResult>() {
@Override
public void onSuccess(GDXFacebookLoginResult result) {
System.out.println("Login: Success--Userid: " + result.getAccessToken().getUserId());
getUserInfo();
}
@Override
public void onError(GDXFacebookError error) {
System.out.println("Login: Error - " + error.toString());
}
@Override
public void onFail(Throwable t) {
System.out.println("Login: Failed");
}
@Override
public void onCancel() {
System.out.println("Login: Cancelled");
}
});
I'm not getting this callback. Nothing is printed on the log except the uncaught reference error. On googling, I found out that it might be because Facebook SDK is not initialized.
Hello!
We are using libgdx in order to create a game on desktop build with maven.
For the login we want to use Facebook sign in.
I try to install your project, it went well on gradle but on maven I received this error :
"[java] gdx-facebook (1.2.4): Error installing gdx-facebook (1.2.4) for Desktop
[java]
[java] gdx-facebook (1.2.4): Did you add >> compile "de.tomgrill.gdxfacebook:gdx-facebook-desktop:1.2.4" << to your gradle dependencies? View https://github.com/TomGrill/gdx-facebook/wiki for more information."
The SignIn fonction finish by the "onError" function and with the message "Sign in error. gdx-facebook (1.2.4) is not installed."
But I had gdx-facebook to the pom.xml and the depency was generated well so i don't understand.
Thank you!
Hi there,
Is there any way at the moment to post any kind of content to a user's page without going through the Facebook review? If not, would it be possible to implement calling of the default sharing interfaces as described here? https://developers.facebook.com/docs/sharing/android
Note: My use case is the following: On Android, the user logs in by default with read privileges, when user starts the "share on Facebook" process at some point while using the app, login with write privileges will initiate. If successful, either a standardized post is written on their page (such as a "Like" post, or any other pre-authorized by Facebook), or the Facebook app takes over and shows a Share dialog (as described in the link above), which the user can then confirm or cancel.
When attempted via gdx-facebook, it runs into several issues. Firstly, logging in with write privileges when the user is logged in (as recommended by Facebook) does not work, as gdx-facebook finds a valid access token with read privileges, uses it and wrongly returns success on the callback (for the login with write privileges), which results in the following error when attempting to post:
(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200
If there's another way to achieve the same effect or I'm misusing the API, feel free to correct me.
Thanks.
Hi,
I'm trying to integrate an ads provider for my android game and it requires that I change my Activity (AndroidApplication) for FragmentActivity and when it comes to test I had a ClassCastException.
Here is the error message :
java.lang.ClassCastException: com.mycompany.mygame.AndroidLauncher$GameFragment cannot be cast to com.badlogic.gdx.backends.android.AndroidApplication
de.tomgrill.gdxfacebook.android.AndroidFacebookLoader.load(AndroidFacebookLoader.java:30)
de.tomgrill.gdxfacebook.core.ReflectionLoader.load(ReflectionLoader.java:53)
de.tomgrill.gdxfacebook.core.GDXFacebookSystem.install(GDXFacebookSystem.java:16)
I followed the instruction here to convert to FragmentActivity:
https://github.com/libgdx/libgdx/wiki/Starter-classes-%26-configuration#fragment-based-libgdx
When I deactivate the use of gdx-facebook the game runs fine.
So how can I make the lib compatible with FragmentActivity ?
And will this issue occur with gdx-twitter too ?
Hi, first of all, thanks for this great contribution, I suggest you to use
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
Instead of having the jar in the android/libs folder
I get this error trying to use the signin feature from desktop. I have already done the GDXFacebookSystem.install(config); and checking with isLoaded();
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: javafx/application/Application
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:133)
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at de.tomgrill.gdxfacebook.desktop.DesktopGDXFacebook.startGUISignIn(DesktopGDXFacebook.java:66)
at de.tomgrill.gdxfacebook.desktop.DesktopGDXFacebook.signIn(DesktopGDXFacebook.java:48)
at com.aperico.game.sylvass.view.LoginWindow.loginFBWithReadPermissions(LoginWindow.java:113)
at com.aperico.game.sylvass.view.LoginWindow.access$6(LoginWindow.java:106)
at com.aperico.game.sylvass.view.LoginWindow$5.changed(LoginWindow.java:360)
at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28)
at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:181)
at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:146)
at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:123)
at com.badlogic.gdx.scenes.scene2d.ui.Button$1.clicked(Button.java:91)
at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89)
at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:58)
at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:353)
at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:332)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:217)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 28 more
I tried running it from command prompt with gradlew desktop:run but same thing. I got no complaints in eclipse and I can see that the desktop project got the gradle dependencies facebook-core and facebook-desktop jars.
I can even open up the de.tomgrill.gdxfacebook.desktop.DesktopDGXFacebook.class and de.tomgrill.gdxfacebook.desktop.JXBrowser.class files in eclipse so they are there...
Tried ofc clean/re-build in eclipse and from gradlew cmd prompt. I use oracle 1.7.0_25 and tried to use both 1.6 and 1.7 code compilance. Got any ideas?
Analogous to TomGrill/gdx-dialogs#9, gdx-facebook uses the same initialization technique as gdx-dialogs, so it probably needs a similar set of ProGuard rules. I'm thinking something along the lines of
-keep class com.badlogic.gdx.Gdx { *; }
-keep class com.badlogic.gdx.backends.android.AndroidEventListener
-keep class de.tomgrill.gdxfacebook.desktop.DesktopGDXFacebook
-keep class de.tomgrill.gdxfacebook.html.HTMLGDXFacebook
-keep class de.tomgrill.gdxfacebook.ios.IOSGDXFacebook
-keep class de.tomgrill.gdxfacebook.android.AndroidGDXFacebook
Hello,
It seems that in the newest version there's no way to properly log-out and log-in again under different fb account.
Yes, we can always do a graph request to revoke permissions. But this will deauthorize the app on a specific platform.
E.g if you have logged in on several android devices. Then you do that kind of log-out on a single device. This will make you log-out an all devices! That's not a normal behavior that we usually see in the games.
I've tested a clean facebook android SDK, it allows you to log out on a single device and log-in again under a different account.
If I'm correct, in the older gdx-facebook version, the local access token cache was cleared every time after log out. This was enough to be able to re-login again.
Is it possible to do something about that?
Thanks!
ps. As a workaround I manually clear the .fbsession prefs file on log-out.
html:compileGwt always fails, everything installed according to wiki instructions:
/gdx-facebook-core-1.2.2-sources.jar!/de/tomgrill/gdxfacebook/c
ore/utils/Utils.java'
[ERROR] Line 46: No source code is available for type java.net.URL; did
you forget to inherit a required module?
[ERROR] Line 72: No source code is available for type java.net.Malforme
dURLException; did you forget to inherit a required module?
[ERROR] Line 81: No source code is available for type java.net.URLDecod
er; did you forget to inherit a required module?
[ERROR] Aborting compile due to errors in some input files
:html:compileGwt FAILED
Hi. I have integrated GDX Facebook with my game client. Now I need to authenticate the user, so I send the token to the server and it should 'GET' the url with token as you wrote on WIKI and get the results in json. As I can see in code, you've implemented json parsers, errors and it would be useful if I just use your system on the server (which is only a java application). Is there a version which doesn't require GDX?
Thanks! And I'm sorry I wrote here, I know that there are only issues.
libgdx 1.93 changes - verify/fix that extension works with intel multi-os engine for ios
Hi,
Wanted to check if you still keep this updated? Some breaking changes from fb-graph at the moment. For example our app stopped being able to load peoples profile pics.
From Facebook:
Your App, xxx, currently has access to Graph API v2.4 which will reach the end of its 2-year lifetime on 09 October, 2017. To ensure a smooth transition, please migrate all calls to Graph API v2.5 or higher.
I get this error trying to do the Android installation.
I have searched up on this bug, but the answers only relate to Android and not LibGDX:
If you visit those links, you will see that the answer suggests having an upgraded version of the facebook sdk, but there is no such option since the instructions only tell you to put this gdx-facebook as a dependency, and not the facebook sdk
It seems the openURL-method does not exist anymore? I am getting a "method does not override method from its superclass". Has it been replaced by something else?
FBSDKAppEvents openURL expects a NSPropertyList, but roboVM only provides a method with a NSObject, which must be something new since it used to work.
Removing it makes the facebook login stop working, so I am assuming I should replace it with something new?
To be clear, this method causes the error:
@Override
public boolean openURL(UIApplication application, NSURL url, String sourceApplication, NSPropertyList annotation) {
// You need to add this line, otherwise Facebook will not work
// correctly!
return FBSDKApplicationDelegate.getSharedInstance().openURL(application, url, sourceApplication, annotation);
}
Facebook Sign in fails with the following error message: Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.
Any fix for this?
Instead of providing a kinda user friendly login mechanism with this library let the implementer of this lib do this? Give the tools, let user handle how he wants, is probably the better approach? Any opinions?
Same is with token storage. This is a security risk in my opinion and should also be managed by the implementer. Any opinions?
This is usually used to invite fb friends to your game and always been important part of the app's social integration. I really need this functionality for my game.
As far as I know there's not much code required from platform-specific fb SDK's to call this request dialog.
Please refer to this article to see what I'm talking about:
https://developers.facebook.com/docs/games/requests/v2.4
https://developers.facebook.com/docs/graph-api/using-graph-api/#fieldexpansion
For example
request.setNode("me?fields=link,first_name,last_name,email,gender,locale,picture");
Always results in an error ("An active access token must be used to query information about the current user."). Permissions are set correctly when signing in.
Any fix for this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.