Solved Include file in package after clicking button
-
As @ambershark said, you cann't change the bundle. This is not specific to Qt. In general app bundling work like this. You can save the data. What is the contents of file ? What is the size of this file content ?
-
@dheerendra Sir contents of file is, it is text file and i want to include it in app internal storage then from there i have to read the data of the file.
-
Same app is going to read or different app should read the file? Are you trying to share the data between two different apps ?
-
@dheerendra same app should read the data, like in watsapp, whenever we set our profile picture, the profile picture goes into watsapp memory, even after deleting that photo from gallery, the photo will be there, like that.
-
You would like to have persistent storage for your app. Across the multiple launch of the applications you should be able to see old data. If this the case you can do it.
-
@Bhushan_Sure
Qt has the QStandardPath class that is more ore less made for this.QString QStandardPaths::writableLocation(QStandardPaths::StandardLocation type)
with
QStandardPaths::AppDataLocation
as type should be what you're looking for.
Keep in mind, you may have to create the path first(like on iOS) but that is the place your appliaction should store it's data. The path/folder will exist, as long as your app is installed on the device. It will remain during updates but will be lost with an app deinstall (at least on iOS and Android) -
@J.Hilk @dheerendra Thank you so much for the support, I will look into QstandardPath :)
-
@J.Hilk @ambershark @dheerendra Hello, I resolved yesterday's doubts, I just Played with "Qfile" and "QstandardPath" and it is done, Solution is below:
1) auto path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
By the above part, i got the path where android app's data is been stored and it is not visible in device, it is not visible anywhere except if the phone is rooted.
/storage/emulated/0/
This path gave me the root directory path of an android operating system.
-
So, i placed a file in root directory and moved it into AppDataLocation.
-
and atlast i deleted the original file.
-
-
Cool. It is good that problem is resolved. Just suggestion. If data you are storing is structured information, you can consider SQLLiteDB as well.
-
@dheerendra okay Sir :)