Change package manager application info meta data in android
-
28-04-2021 - |
문제
I would like to change the value of a meta-data in the AndroidManifest.xml file :
I am using the following code :
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(
activity.getPackageName(), PackageManager.GET_META_DATA);
applicationInfo.metaData.putString("dataName", "2");
But the applicationInfo is not saved into the package manager. When packageManager.getApplicationInfo() is called afterwards, I get the old value.
I didn't see a setApplicationInfo() method, how can I proceed ?
Thanks
해결책
AFAIK, the applicationInfo that getApplicationInfo returns is always a copy and there are no apis to change metadata
다른 팁
This meta data can be only supplied from Manifest file and can not be changed after that(as pointed above it will always return a copy and even if update it in some component it will not get updated originally)
제휴하지 않습니다 StackOverflow