Question

I have a question, can I take info from apk file?? I have to compile my app one time but change the name for several times, I would like to take the info from apk file but I can´t take the apk name (only the package name following these posts How to get the file *.apk location in Android device and Android: how to get the name of apk file programmatically?)

Is it possible?? Thanks everbody

Was it helpful?

Solution

I have to add a code in the apk name and I have to take it

1) Users can give a downloaded file any name they want. 2) Android renames apk during installation
e.g. you put yourapp-yourcode.apk on your SD card and install it.
in /data/app (where android creates a copy of installed files) the file will be named this.is.your.package.name-?.apk where the ? is a number (in my /daga/app folder, it is 1 or 2)



=> You should find another location to place your code.

OTHER TIPS

If you have obtained package name , then you almost done. try this one.

Package myPackage = Manifest.class.getPackage();
    String specTitle = myPackage.getSpecificationTitle();
    String vendor = myPackage.getSpecificationVendor();
    String virsion = myPackage.getSpecificationVersion();

specTitle will return you the name if available else it will return 'unknown'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top