Accessing android:installLocation manifest attribute

前端 未结 4 1261
小鲜肉
小鲜肉 2021-01-02 20:15

I\'m trying to write an Android 2.2 app that will find installed apps that can be moved to the SD card. The permission to do this is encoded in the AndroidManifest.xml file

4条回答
  •  无人及你
    2021-01-02 20:49

    Considering all other direct attributes of the manifest tag are available from PackageInfo, I think you're right to look for it there.

    I know it's not in the doc, but did you try anyway? Something like

    PackageInfo pkg = ...;
    String loc = pkg.installLocation();
    

    I know this is probably very naive considering the doc may even be generated automatically - and I wouldn't dare suggest it if I could try it myself (stuck on API 7 at the moment due to retarded OS not supported anymore in 8)

    If it doesn't work, I'm afraid they just overlooked that - I can't imagine they would put it elsewhere all of a sudden. In that case, you'll probably be stuck parsing the manifests by yourself indeed.

提交回复
热议问题