public static Boolean modifyManifest(PTData data, String code)
{
Console.WriteLine(TAG + " code::" + code);
string mDir = data.ApkPath + Path.DirectorySeparatorChar + "test" + Path.DirectorySeparatorChar
+ "AndroidManifest.xml";
Console.WriteLine(TAG + " path::" + mDir);
//读取xml
XmlDocument doc = new XmlDocument();
doc.Load(mDir);
XmlNodeList mtNodeList = doc.SelectNodes("//meta-data");
foreach (XmlNode node in mtNodeList)
{
string name = node.Attributes["android:name"].Value;
//Console.WriteLine("name::" + name);
string value = node.Attributes["android:value"].Value;
//Console.WriteLine("value::" + value);
if ("AD_CODE".Equals(name) && value != null)
{
node.Attributes["android:value"].Value = code;
doc.Save(mDir);
}
}
return false;
}