I want to set app meta data using code. Is it possible in Android ? Trying to set Facebook app id into code not inside manifest.
meta-data android:name="com.facebook.sdk.ApplicationId"android:value="@string/applicationId"
Please help me.
I want to set app meta data using code.Is it possible in android ?
No, it's not possible. The manifest get's parsed at compile time -> you can't add meta-data at runtime.
for add any metadata dynamically you can use this code:
try {
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
applicationInfo.metaData.putString("Your Key", "Your Value");
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With