Solved Include file in package after clicking button
-
Hello all,
So i am making one app, so after deploying that app in mobile, there will be one button , after clicking that button one file from Mobile file manager should be include in that app bundle and that file should not be present in mobile, basically file should move from file manager to app bundle.
Is there anything like tha,t so i can proceed.Thank you in Advance :)
-
@Bhushan_Sure I'm not understanding the question, but from what I think it's asking, you are asking if you can take a file from the mobile device and include it in the app bundle for your application that was loaded on the device?
If I'm reading that correctly then no there is no way to do that. You should not be able to modify the appbundle once it's signed and loaded on the device.
-
@ambershark yes question is right, so we can't include it in bundle, but can we save a file inside app internal storage, for example, gallery pic saving inside app.
is that possible ? gallery pic is an example, similar to that something ? -
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 :)