Reputation: 4904
<provider android:authorities="com.facebook.app.FacebookContentProvider{app id here}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
Can i change Facebook appId programmatically in Android app?
Upvotes: 2
Views: 1557
Reputation: 374
If you want to change it depending on your build type, you can use a string resource to replace the actual value of your Facebook Id.
<provider
android:authorities="@string/FB_APP_ID"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
Then on your build.gradle define the value of FB_APP_ID per built type.
buildTypes{
debug{
resValue "string", "FB_APP_ID",
"com.facebook.app.FacebookContentProvider{appid1}"
}
release{
resValue "string", "FB_APP_ID",
"com.facebook.app.FacebookContentProvider{appid2}"
}
}
Upvotes: 6