title: Obtaining the name of an Android APK using C++ and the NativeActivity class
body: <p>I'm writing an Android app using the NDK and NativeActivity. My app depends on a few bits of third party code that are shipped as assets. Currently I'm working on trying to extract those assets while keeping the folder structure intact.</p>
  
  <p>I've tried using the AssetManager, but to keep the folder structure intact it seemed like there would a huge amount of code involved, for a simple task such as what I've mentioned. I've since switched focus to try to implement treating the APK as a ZIP file and extract its contents that way. But that requires I find the exact path to the APK.</p>
  
  <p>In a normal Android app one would use getPackageCodePath, but this is an abstract method attached to the Context class. My question is how do I obtain the exact path to the APK when not using a normal Activity?</p>
  
  <p>Also I tried calling getPackageCodePath via JNI, but that crashed the app on account of not being able to find the method.</p>
  
  <p>EDIT:
  Is this even possible?</p>