Change package manager app metadata in android

I would like to change the metadata value 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 applicationInfo is not saved in the package manager. When packageManager.getApplicationInfo () is called later, I get the old value.

I have not seen the setApplicationInfo () method, how can I continue?

thanks

+4
source share
2 answers

AFAIK, the applicationInfo that returns getApplicationInfo is always a copy and there is no apis for changing metadata

+3
source

This metadata can only be provided from the manifest file and cannot be changed after that (as indicated above, it will always return a copy even if the update in some component will not be updated initially)

+1
source

Source: https://habr.com/ru/post/1395749/


All Articles