Skip to content Skip to sidebar Skip to footer

How To Enable Logging In Facebook Sdk 3.0?

recently i am trying to get my hash key for my android app that uses facebook. The problem is the method through the command prompt is not working for me. So i found a new solutio

Solution 1:

To enable logging call the function Settings.addLoggingBehavior(LoggingBehavior behavior)

For example if you want to display Request information call

Settings.addLoggingBehavior(LoggingBehavior.REQUESTS);

You can check the class LoggingBehavior to debug other operations: https://developers.facebook.com/docs/reference/android/3.0/LoggingBehavior

Solution 2:

Normally Android libraries can use BuildConfig.DEBUG to determine if the app is in debug mode. However, due to a bug in Gradle, Android libraries are always built with DEBUG set to false. As a workaround, there is a FacebookSdk.setIsDebugEnabled(boolean) method so you can directly set the debug mode from your app. This enables debug logging from the SDK.

You can also set logging behaviors with FacebookSdk.addLoggingBehavior(LogginBehavior) to enable logging for different categories of messages. See the Android SDK Reference, LoggingBehavior.

From here.

Solution 3:

According Pascal's comment on a similar thread, this method is not working since december 2012. So you will have to use the commandprompt method to get the correct hash key.

"ENABLE_LOG cannet be changed anymore since December 2012 – Pascal Klein Feb 24 at 3:41" here is a link to the thread: Android: Facebook login doesn't work

I tried several commands in the command prompt and now I finally found one that worked for me. I hope it will work for you too. (I use x64 Windows 7)

Download this version of openssl: openssl for x64 Windows

Make a folder called openssl in your C:\ directory.

Extract the openssl zip in the openssl folder.

Go to the location of the keytool.exe (C:\Program Files (x86)\Java...\bin)

While holding shift, right click the bin folder and open a command prompt window.

Enter the following:

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\"username"\.android\debug.keystore" | "C:\openssl\bin\openssl" sha1 -binary | "C:\openssl\bin\openssl" base64 

(replace "username" with your username. Without the quotes of course)

You must enter the password: android

Your hash key should appear. (if you get a '=' in the key, don't delete it. Its part of the key)

Good luck building your application!

credits to C Abernathy for posting this method.

Post a Comment for "How To Enable Logging In Facebook Sdk 3.0?"