简体   繁体   中英

Reading your own application file in android?

I want to read my own android application file from code. I mean to say suppose my filename is abc.apk which has got installed on the phone.Now through the same application (abc.apk) , I want to read abc.apk file byte by byte . Is it possible through code.

EDIT : I am editing the question for further usage. How can I get the current filename of my android application through native code.

Thanks , Chetan

It is possible. Here is example project that does it: http://dl.dropbox.com/u/1923577/android_native_read_apk.7z

It includes all the source code (java nad C++). If you install apk file from bin folder and run on device it will print out to android log "D/TEST (18107): First 4 bytes = 50 4b 03 04". And that is exactly first 4 bytes of apk file (check it with hexeditor). I am running this on non-rooted device.

I don't think this possible on a stock device. data/app/ directory cannot be accessed directly without root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM