Parse APK files using the High Level API
mainUse the apk package to open and inspect Android APK files. The apk.OpenFile function allows you to access high-level metadata such as the application's icon, package name, and localized labels.
Note that retrieving labels requires a ResTableConfig to specify the desired language configuration (e.g., using androidbinary.ResTableConfig).
package main
import (
"github.com/shogo82148/androidbinary/apk"
"github.com/shogo82148/androidbinary"
)
func main() {
pkg, _ := apk.OpenFile("your-android-app.apk")
defer pkg.Close()
icon, _ := pkg.Icon(nil) // returns the icon of APK as image.Image
pkgName := pkg.PackageName() // returns the package name
resConfigEN := &androidbinary.ResTableConfig{
Language: [2]uint8{uint8('e'), uint8('n')},
}
appLabel, _ := pkg.Label(resConfigEN) // get app label for en translation
}