From e6d801a5946c472b4acf73f0dff2ead41907f448 Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Fri, 15 Jun 2012 18:38:46 -0700 Subject: [PATCH] adding appinfo --- .../ApplicationInfo/ApplicationInfo.class | Bin 0 -> 1941 bytes .../ApplicationInfo/ApplicationInfo.java | 44 ++++++++++++++++++ .../cordova/ApplicationInfo/manifest.txt | 1 + 3 files changed, 45 insertions(+) create mode 100644 bin/templates/cordova/ApplicationInfo/ApplicationInfo.class create mode 100644 bin/templates/cordova/ApplicationInfo/ApplicationInfo.java create mode 100644 bin/templates/cordova/ApplicationInfo/manifest.txt diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class new file mode 100644 index 0000000000000000000000000000000000000000..6b854f7d209a1bea4014ab9b59749ed15d2cd7dc GIT binary patch literal 1941 zcma)7TUQ%Z6#h0+2_x{e|-($CR!?zxS?`&OOg*&e1wk^ z_ynKEaXWzoX5yHY-*X9khC2%G#_@R{=CKgRqJn!WmaweiKE6<}q9TPa6?~;)Q1XI` zA<0)&4C6)|MU{4I@?$-YuOzVU*)pe}us$pB(rsoS>$QE{t=Z0Q4?3!NkUCXY`NY)oK%@jod<@etEL&hG`>40MT5?)$#ay<6(DTh^-KrSA<=89swv(3;HC)FSooe_F z4>fFJOTi-z-{Y}@CmMdhQvsz(3`Wh=V4y4zH!8mM-17G{R8Unw`8H|-1CCqMU)-wb zRi~jZ)y;-!Gc(QTgRg;x~!wS=-Asp$uE$vp!rp!)*gE4_&2}s&_#;#tPfB0sfSc90B zqpz%WNz-qUbk1O*W!0;uOSmlt%U3N|Llb2UKY_xup3m#2jxx`98a((KG7@?6RMAhQ z+X*6&m2pp|ch9M`WC4#5EVJg0yC;ya%@-@S=Noo~-87Y*2oC-%wzC2$8lQ43kU5JF z8ejikkOI-*bOds}+PTo(AIC80c(9k8U~8s-to5dw(gfSBezZX^8rA20-kfsFXJy8F zA~=1%GCJ*!ym$+H8%C|jK0QkYMc(j&<@u*GIF|EvTE5wkcYEa|XsJP~uD&nrd4X!! zX~|*Gxyc8}z`CqU;K&31a@#7ybx{4U?}ipxlK&XQ!X z3dYWcYse-`utMvu(==V54Hz?;P1CLlO!ols--t*3OZ0KyIqvttqn0}Xjf3bKhq?TP z!FIzK>AU>8OfJZyxmOS`xe$1dG!_W^pvsHJHC07~QiXfo0YZhzHp0c}TpN+qsY65s zW+EezRO}E+2s6>CRQwQqA%qX1hVTaxDXp^;`vvDx@5Fvbax**aYL+ literal 0 HcmV?d00001 diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java new file mode 100644 index 00000000..9a663217 --- /dev/null +++ b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java @@ -0,0 +1,44 @@ +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.xml.sax.SAXException; +import java.io.IOException; + +public class ApplicationInfo { + private static void parseAndroidManifest(String path) { + // System.out.println(path); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + Document dom; + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + dom = db.parse(path); + + // getting package information + Element manifest = dom.getDocumentElement(); + String pakkage = manifest.getAttribute("package"); + + // getting activity name + String activity = ((Element)dom.getElementsByTagName("activity").item(0)).getAttribute("android:name"); + System.out.println(String.format("%s/%s.%s", pakkage, pakkage, activity)); + } catch(ParserConfigurationException pce) { + pce.printStackTrace(); + } catch(SAXException se) { + se.printStackTrace(); + } catch(IOException ioe) { + ioe.printStackTrace(); + } + + } + + public static void main(String[] args) { + String path; + if(args.length > 0) { + path = args[0]; + } else { + path = System.getProperty("user.dir") + "/../AndroidManifest.xml"; + } + parseAndroidManifest(path); + } +} diff --git a/bin/templates/cordova/ApplicationInfo/manifest.txt b/bin/templates/cordova/ApplicationInfo/manifest.txt new file mode 100644 index 00000000..7d77999c --- /dev/null +++ b/bin/templates/cordova/ApplicationInfo/manifest.txt @@ -0,0 +1 @@ +Main-Class: ApplicationInfo