2

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?

tse
  • 5,769
  • 6
  • 38
  • 58

1 Answers1

1

You may not do this directly as far as I know. But here is a workaround:

  1. Look for apk from installed package using adb shell pm list -f | grep com.aaa.bbb.ccc. The format will be like package:${path}=com.aaa.bbb.ccc
  2. Pull apk from device. On some of the devices this can be done directly, but on the other devices, you will have to copy apk to sdcard using cp ${path} /sdcard. Then pull apk using adb pull.
  3. Use 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
苏风臣
  • 26
  • 2