Wess
Wess

Reputation: 779

Android Facebook ContentProvider and multiple Build Types

I have setup Facebook sharing with the below, build type specific content provider:

<provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="com.facebook.app.FacebookContentProviderXXX${applicationId} ...

applicationId is different per build type, so that I am able to run debug and live builds side by side on one device.

This setup gives me an error on Facebook (image file) sharing:

IllegalStateException: A ContentProvider for this app was not set up in the AndroidManifest.xml, please add com.facebook.app.FacebookContentProviderXXX as a provider to your AndroidManifest.xml file. See https://developers.facebook.com/docs/sharing/android for more info.

How can I overcome this problem? How can I get Facebook to take into account my applicationId?

Upvotes: 2

Views: 4384

Answers (3)

pRaNaY
pRaNaY

Reputation: 25312

You Manifest code look like below for facebook login and sharing:

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/{facebook_app_id}" />
    <!-- To use Facebook Login or Share, also add the FacebookActivity to the manifest:-->
    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <!-- If you're sharing links, images or video via the Facebook for Android app, you also need to declare
    the FacebookContentProvider in the manifest. -->
    <provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="com.facebook.app.FacebookContentProvider${facebook_app_id}"
        android:exported="true" />

NOTE:

Your app is currently live and available to the public.

Follow below step to make your facebook app live and public:

1) Goto https://developers.facebook.com/

2) Select your app and goto App Review tab.

3) Check YES for Your app is currently live and available to the public. option.

See I am new How do I make my app live on FB

Upvotes: 1

Frank
Frank

Reputation: 12300

Your “applicationId” probably is "com.myname.blabla", and XXX your facebook app id?

I think you should switch to using 2 facebook APP_ID's, and not "applicationId". Put the facebook APP_ID's in your build types and reference them in your manifest. You then don't need to add the "applicationId" from your app.

<provider
  android:name="com.facebook.FacebookContentProvider"
  android:authorities="com.facebook.app.FacebookContentProvider${FACEBOOK_APP_ID}"
  android:exported="true" />

Upvotes: 1

Dhruv
Dhruv

Reputation: 1799

Try with this:

If your APP_ID is 95xxx3xx60xx73xx, then it should be like:

<provider
    android:name="com.facebook.FacebookContentProvider"
    android:authorities="com.facebook.app.FacebookContentProvider95xxx3xx60xx73xx"
    android:exported="true" />

For more information, you can follow this link.

Upvotes: 0

Related Questions