File tree Expand file tree Collapse file tree 1 file changed +49
-4
lines changed Expand file tree Collapse file tree 1 file changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -6,22 +6,67 @@ androidbinary
6
6
7
7
Android binary file parser
8
8
9
- ## Parse XML binary
9
+ ## High Level API
10
+
11
+ ### Parse APK files
10
12
11
13
``` go
12
14
package main
13
15
14
16
import (
15
- " fmt"
17
+ " github.com/shogo82148/androidbinary/apk"
18
+ )
19
+
20
+ func main () {
21
+ pkg , _ := apk.OpenFile (" your-android-app.apk" )
22
+ defer pkg.Close ()
23
+
24
+ icon , _ := apk.Icon (nil ) // returns the icon of APK as image.Image
25
+ pkgName := pkg.PackageName () // returns the pakcage name
26
+ }
27
+ ```
28
+
29
+ ## Low Lebel API
30
+
31
+ ### Parse XML binary
32
+
33
+ ``` go
34
+ package main
35
+
36
+ import (
37
+ " encoding/xml"
38
+
16
39
" github.com/shogo82148/androidbinary"
17
- " os "
40
+ " github.com/shogo82148/androidbinary/apk "
18
41
)
19
42
20
43
func main () {
21
- f , _ := os.Open (" AndroidManifest" )
44
+ f , _ := os.Open (" AndroidManifest.xml " )
22
45
xml , _ := androidbinary.NewXMLFile (f)
23
46
reader := xml.Reader ()
47
+
24
48
// read XML from reader
49
+ var manifest apk.Manifest
50
+ data , _ := ioutil.ReadAll (reader)
51
+ xml.Unmarshal (data, &manifest)
52
+ }
53
+ ```
54
+
55
+ ### Parse Resource files
56
+
57
+ ``` go
58
+ package main
59
+
60
+ import (
61
+ " fmt"
62
+ " github.com/shogo82148/androidbinary"
63
+ )
64
+
65
+ func main () {
66
+ f , _ := os.Open (" resources.arsc" )
67
+ rsc , _ := androidbinary.NewTableFile (f)
68
+ resorce , _ := rsc.GetResource (androidbinary.ResId (0xCAFEBABE ), nil )
69
+ fmt.Println (resource)
25
70
}
26
71
```
27
72
You can’t perform that action at this time.
0 commit comments