Search code examples
androidfacebook-android-sdkapp-id

how can i send metadata programmatically in android?


i'm using facebookSDK to share text and images, but i need to send the app_id as parameter programmatically and not from the AndroidManifest.xml ... any suggestions ?

<meta-data
     android:name="com.facebook.sdk.ApplicationId"
     android:value="@string/app_id" />

Solution

  • ApplicationInfo info = getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
    Bundle bundle = info.metaData;
    String appId = bundle.getString("com.facebook.sdk.ApplicationId");