Programmatically retrieve permissions from manifest.xml in android

前端 未结 5 714
无人共我
无人共我 2020-12-05 18:39

I have to programmatically retrieve permissions from the manifest.xml of an android application and I don\'t know how to do it.

I read the post here but I am not ent

5条回答
  •  春和景丽
    2020-12-05 19:05

    I have a simple C# code, "using System.Xml"

    private void ShowPermissions()
       {
        XmlDocument doc = new XmlDocument();
        doc.Load("c:\\manifest.xml");
    
        XmlNodeList nodeList = doc.GetElementsByTagName("uses-permission");
    
    
        foreach(XmlNode node in nodeList)
        {
            XmlAttributeCollection Attr = node.Attributes;
            string Permission=Attr["android:permission"].Value;
    
            MessageBox.Show(Permission);
        }
    }
    

提交回复
热议问题