Get application folder of current app
i wrote an application for an android device using qt 5.2. In order to copy some library that should be loaded at runtime i need to transfer them from the sdcard to the internal storage.
Therefore it is proposed to use
PackageManager pm = context.getPackageManager();
String dataDir = pm.getApplicationInfo(context.getPackageName(), 0).dataDir;
But how to achieve using QTAndroidExtras? There is no static function that provides the context. Is there a built in solution for that?
How about loading the library as part of the APK install file? No copying needed then.
Thanks for your response. Since its determined at runtime which version of the library is used i can't provide it in the apk file. I have to do it at runtime.
That is what you get for thinking too complicated...
QDir provides two static functions returning a folder with write permissions for the application:
Now everything works, i copy the libraries from the sdcard into this directory and load them afterwards.
Yes, sometimes you have to take a step back. If it's getting too complicated, maybe you are going about it the wrong way...
I did it this way: