I am using sqlite database in my application,i want to copy this sqlitedatabase file when creating apk file and paste on mobile during the installation of the application.Is there any packaging options to do this ?
Thanks in advance
Ragu, there is a broadcast that occurs when installing apps from the market place but since you are installing your app, the event obviously doesn't get received by your app.
Copy the database file to your assets folder and on the first invocation of the application, you might be able to copy the file from your asset folder into internal storage.
Related
I have a project in android studio. Now i want to build an apk file of this project with the bulit in sqlite database.
How can i do this?
Assuming that you have the built in database (pre-loaded/pre-existing database) in the assets folder, and that you have implemented the code to access the database (generally this is a means of copying the database from the assets folder to a usable location).
Then you simply produce the APK no differently to building any other APK.
In short the database is just an asset and thus forms part of the package.
After installed, where can I find the files used by my app?
For example, my app use a sqlite plugin and it generate a database file, "dummy.db". I need to have access to this file but I don't know where it is.
If you run your app on emulator, you may open the emulator via Android Device Monitor and find your app's database using the path 'data/data/your_app_package_name/databases'.
I have developed an app which uses cache file directory
"mypackagename" and database directory
"/data/data/com.mypackagename"
How can I delete these files programmatically while uninstalling the app?
App storage is deleted automatically when uninstalled. You don't have to write any code for that.
I change my .apk file to .zip and open it on WinRAR. The problem is assets folder is showing so my JS and HTML files are shown. I am using Cordova to develop my app.
How can I hide the assets from the .apk?
If you wouldn't have the assets on the .apk, how could they be in the device when you install the app? Of course those need to be available and as it says already on the security guide of Cordova:
Do not assume that your source code is secure
Since a Cordova application is built from HTML and JavaScript assets that get packaged in a native container, you should not consider your code to be secure. It is possible to reverse engineer a Cordova application.
After installing the app on the device, you are of course allowed to download the assets from online and even store them for offline usage with something like File plugin, but that is completely different case and maybe not even what you wish to do.
Cordova - How to hide asset folder in .apk
1)Encrypted all Cordova assets files.
2)Decrypt the files and move to the internal storage during runtime.
3)Access your assets files from internal storage( this.getFilesDir().getAbsolutePath()).
Following these things will keep your file and method calling safe as they are accessible only
to internal storage.
Replace launchUrl "android_asset" to "data/data/io.cordova.hellocordova/files/"
Example: modify the dev source.
1) "file:///android_asset/www/index.html"; to Replace
"file:///data/data/io.cordova.hellocordova/files/www/index.html";
2) "file:///android_asset/www/index.html"; to Replace
"file:///data/data/io.cordova.hellocordova/files/www/index.html";
I made an Android activity and deploy it to my device using eclipse. Now i would like to add a INI configuration file to it.
What would be the right place to install this file on the device ?
I want want this configuration file to be modifyable without having to open the project using eclipse so that someone without programming knowledge or developping tools could still be able to modify this config file.
Thank you :)
What would be the right place to install this file on the device ?
External storage. It is the only place the user has access to.
You might package a template or starter version of your configuration file inside your app, such as in assets/, then copy that file to external storage on first run of your app (or if the user accidentally deletes or corrupts the copy on external storage).