Frage

I haven't been able to find anything specific to this issue I'm having, so I thought I would post it here.

I have an Android Unity app I'm working on, with the Facebook SDK plugin. When working in the Unity editor, I can log in with my test users via their access tokens just fine. When deploying the app to an Android device however, it depends on whether the Facebook App itself is installed on the device.

If the Facebook App is installed on the device, my test users cannot log in at all. If I uninstall the Facebook App, the test users log in successfully as expected.

Is there a setting/configuration change/API call, something that I need to do in order to fix this? Obviously I would like my app to log in whether the device has the app installed or not.

Thank you very much for any info

Edit: I should clarify - if the Facebook App is installed, when the user logs in through my app, it does log them in with the Facebook App, but doesn't log them in within my app

Some more info which narrows things down some (I apologize for it being lengthy): Once a test user account does get logged in successfully in my app (without the Facebook App itself being installed on the device), from that point forward that test user account will log in to my app just fine even with the Facebook App installed.

Scenario:

  1. Test user "Bob" is configured for my app, have preinstalled configured

  2. "Bob" will log in with a token through Unity editor every time, issue is only on device

  3. Tablet has Facebook App installed

  4. Run my app on the device, try to log in with "Bob"

  5. Facebook App login dialog is instantiated for the login.

  6. App authorization dialog pops up, click OK to approve it

  7. My app returns back to the main scene, but "Bob" is not logged in

  8. Open the Facebook App, and find that "Bob" is logged into the Facebook App just fine

  9. Uninstall the Facebook App from the device

  10. Run my app (after clearing data), try to log "Bob" in again

  11. Smaller Facebook login dialog is instantiated, followed by auth dialogs

  12. "Bob" logs in to my app just fine

Now - here is what else I found. Going along with that scenario - once I get a test user account logged in successfully for the first time through my app, I can reinstall the Facebook App, and it will have no impact on logging in again. Once he's been logged in once with my app, he'll be fine from that point forward. But if the Facebook App is installed when attempting to log in and approve the app the first time, it fails.

As requested, here is a logcat from a failed login attempt. There definitely looks to be several issues, a permissions exception right off the bat, and perhaps that it trickling through to cause everything to fail. I'm not sure why there would be an issue with permissions as I'm sending request for email and publish_actions only, just as in the examples. In the end, my OnInitCallback is called with an indication that the login was cancelled (even though the authorization dialogs appeared and OK was clicked). Maybe that's FB way of eloquently backing out when things blow up? Not sure. In any case, I still haven't been able to solve how and why this is happening. Maybe I shouldn't worry about it and just hope and pray that the release build and actual users will be able to connect ok?

W/fb4a(:<default>):BlueServiceQueue(28412): Exception during service

W/fb4a(:<default>):BlueServiceQueue(28412): com.facebook.http.protocol.ApiExcept
ion: The app cannot ask for publish or manage permissions along with read permis
sions.

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseChecker.b(ApiResponseChecker.java:83)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseChecker.a(ApiResponseChecker.java:162)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponse.g(ApiResponse.java:151)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.auth.se
rver.AuthorizeAppMethod.a(AuthorizeAppMethod.java:275)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.auth.se
rver.AuthorizeAppMethod.a(AuthorizeAppMethod.java:31)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseHandler.a(ApiResponseHandler.java:55)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseHandler.handleResponse(ApiResponseHandler.java:28)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.a(FbHttpRequestProcessor.java:314)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.a(FbHttpRequestProcessor.java:144)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.b(FbHttpRequestProcessor.java:100)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.a(FbHttpRequestProcessor.java:230)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Si
ngleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:402)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Si
ngleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:164)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ab
stractSingleMethodRunner.a(AbstractSingleMethodRunner.java:18)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.common.
server.SimplePlatformOperation.a(SimplePlatformOperation.java:40)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.common.
server.PlatformOperationHandler.a(PlatformOperationHandler.java:60)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.fbservice.servic
e.BlueServiceQueue.e(BlueServiceQueue.java:329)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.fbservice.servic
e.BlueServiceQueue.d(BlueServiceQueue.java:55)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.fbservice.servic
e.BlueServiceQueue$3.run(BlueServiceQueue.java:258)

W/fb4a(:<default>):BlueServiceQueue(28412):     at java.util.concurrent.Executor
s$RunnableAdapter.call(Executors.java:422)

W/fb4a(:<default>):BlueServiceQueue(28412):     at java.util.concurrent.FutureTa
sk.run(FutureTask.java:237)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.common.executors
.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:59)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.Handler.handleCall
back(Handler.java:733)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.Handler.dispatchMe
ssage(Handler.java:95)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.Looper.loop(Looper
.java:136)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.HandlerThread.run(
HandlerThread.java:61)

W/fb4a(:<default>):GDPDialog(28412): Failed to send

W/fb4a(:<default>):GDPDialog(28412): com.facebook.fbservice.service.ServiceExcep
tion: API_ERROR: API_ERROR

W/fb4a(:<default>):GDPDialog(28412):    at com.facebook.fbservice.ops.BlueServic
eOperation.c(BlueServiceOperation.java:639)

W/fb4a(:<default>):GDPDialog(28412):    at com.facebook.fbservice.ops.BlueServic
eOperation.c(BlueServiceOperation.java:47)

W/fb4a(:<default>):GDPDialog(28412):    at com.facebook.fbservice.ops.BlueServic
eOperation$2.run(BlueServiceOperation.java:604)

W/fb4a(:<default>):GDPDialog(28412):    at android.os.Handler.handleCallback(Han
dler.java:733)

W/fb4a(:<default>):GDPDialog(28412):    at android.os.Handler.dispatchMessage(Ha
ndler.java:95)

W/fb4a(:<default>):GDPDialog(28412):    at android.os.Looper.loop(Looper.java:13
6)

W/fb4a(:<default>):GDPDialog(28412):    at android.app.ActivityThread.main(Activ
ityThread.java:5017)

W/fb4a(:<default>):GDPDialog(28412):    at java.lang.reflect.Method.invokeNative
(Native Method)

W/fb4a(:<default>):GDPDialog(28412):    at java.lang.reflect.Method.invoke(Metho
d.java:515)

W/fb4a(:<default>):GDPDialog(28412):    at com.android.internal.os.ZygoteInit$Me
thodAndArgsCaller.run(ZygoteInit.java:779)

W/fb4a(:<default>):GDPDialog(28412):    at com.android.internal.os.ZygoteInit.ma
in(ZygoteInit.java:595)

W/fb4a(:<default>):GDPDialog(28412):    at dalvik.system.NativeStart.main(Native
 Method)

V/FBUnitySDK(30488): sending to Unity OnLoginComplete({"cancelled":true,"key_has
h":"(my keyhash was here)"})
War es hilfreich?

Lösung

We have test users logging into our unity app on Android with the FB app installed (sdk 5.0.4).

FB.Login("email,publish_actions", callback )

If you have a different scope, try removing some as the exception in your log indicates that is the problem. From the Facebook documentation, the readonly and publishing permissions should be made separately: https://developers.facebook.com/docs/facebook-login/permissions/#publishing

Once the users have logged in once, the login/validation happens in FB.Init() and so a different code path is taken.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top