You can use one Facebook app ID in multiple Android apps. Just use the same app ID in another app for login, sharing, and so on.
For deep linking and opening your app through notifications and other means, we only support a single package name/class name combination.
If you want multi-app support for deep linking, see App Links.
You can override strings in the Facebook SDK for Android can by providing a translation in your own
strings.xml file for the desired locale.
strings.xml file in the
facebook/res/values/ directory contains all the strings that the SDK uses. The name of the string resources should be self-explanatory.
For more information, see Android Developer's Guide: Localizing with Resources.
Every release of the Facebook SDK for Android with the native Share dialog also includes an APK for the Facebook app.
This APK was in the SDK download until release 3.14.1. After this time it became a separate download. You can find the APKs on our Downloads page.
Simply install the Facebook APK on your Android emulator or device and test the native Share dialog from your app.
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.
The Share dialog makes callbacks into
onCancel upon a user action.
onSuccesswhen the user successfully shares. Furthermore, there will also be a
Sharer.Resultclass if the user gave the app
publish_actionspermissions. If that user has not logged in with Facebook Login, this method will also be called if the user clicks Cancel.
onCancelwhen someone clicks Share dialog's
Xbutton or if they have logged in with Facebook Login and clicked Cancel.
The following features in the Facebook SDK for Android are not supported on Android Gingerbread, API Levels 9 and 10:
When you request publish permissions, you may get the error:
This error message means that your app is trying to request new permissions before the previous request completed. All requests for permissions are asynchronous and you can't request new permissions until the previous request completes.
See our sample apps provided with the SDK such as Scrumptious or Hello Facebook to see how to ask for new permissions in multiple steps.
If there are no errors in the logs the likely cause is that the request was never executed. To execute the
GraphRequest, call the
To login or use the native Share dialogs, you need to tell Facebook about the key that you use to sign your apps.
This is a key hash which is a SHA-1 hash of the key used to sign your app. Usually there will be at least two different keys used, one for development and debug, and one for release. Verify that both values have been added in your app's settings page.
For more information, see Getting Started Android SDK - Create a Development Key Hash.