There is a way to add some metadata to AndroidManifest.xml for an app, a service or an activity (https://stackoverflow.com/a/38699357/1263771):
<application android:icon="@drawable/icon" android:label="@string/app_name">
<meta-data android:name="my_test_metagadata" android:value="testValue" />
......
</application>
How to get that metadata from the installed app by the adb command?
You may not do this directly as far as I know. But here is a workaround:
adb shell pm list packages -f | grep com.aaa.bbb.ccc
. The format will be like package:${path}=com.aaa.bbb.ccc
cp ${path} /sdcard
. Then pull apk using adb pull
.aapt
in android build-tools to view metadata like aapt l -a ${apk_local_path} | grep -A 2 metadata
. The command after grep
can be changed as you need. The above example is for list all meta-data with non-array value