NDK Assets folder
It seems that applications perform differently when debugged - running on the device (PlayBook Tablet) and if they are signed.
I have included a few files in my assets folder
for example:
app/native/assets/Home/myfile.dat
and at a certain point in my code I have:
std::string strFile = "app/native/assets/Home/myfile.dat";
* FILE pFile = fopen (strFile.c_str (), 'r + b');
If (pFile)
{
do something
}
the code above works well when you run an application that is not signed, whether a debug or release version. At the time I sign my .bar and download on the device the fopen fails.
The call:
If (stat (strFile.c_str () & sts)! = 0)
fprintf (..., "%d, %s\n", errno strerror(errno) (errno));
To check the reason for the failure, I get the error code: 3 which is: no such process
On the other hand if I have:
* FILE pFile = fopen (strFile.c_str (), "rb");
then runs ok and pFile code! = NULL
As I said, it seems that applications perform differently when debugging - move on the device (Tablet PlayBook), if they are signed.
The entire application / folder (content of the .bar file, unpacked) are read-only when running on the device as a signed application.
In debug mode, they are writeable, but which only aims to support the capacities of development such as the update only some of the files, to speed up the deployment.
Apps must / can never actually change the code, or their own assets and all the files that must be supplied with the application but changed the runtime must be copied to the data / folder the first time the application is launched.
See https://developer.blackberry.com/native/documentation/com.qnx.doc.native_sdk.devguide/com.qnx.doc.na... for general information.
Tags: BlackBerry Developers
Similar Questions
-
Cannot create a .db file in the assets folder
I am trying to create a quizz.db file in the current folder by creating first a temporary quizz.db in the folder data and then creating tables inside and then copy it in the current folder. By debugging code, it shows that the folder is created. But I can't find it in the current folder. Here is the code
#include
#include #include #include using namespace bb::cascades; using namespace bb::data; SQLTest::SQLTest(bb::cascades::Application *app): QObject(app) { const QString fileName = QString("quizz.db"); QString dataFolder = QDir::homePath(); QString newFileName = dataFolder + "/" + fileName; QTemporaryFile file(newFileName); // Open the file that was created if (file.open()) { // Create an SqlDataAccess object SqlDataAccess sda(newFileName); // Create a table called Employee in the database file sda.execute("CREATE TABLE Employee( firstName VARCHAR(50),lastName VARCHAR(50), salary INT);"); // Insert employee records into the table sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Mike\", \"Chepesky\", 42000);"); sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Westlee\", \"Barichak\", 55000);"); sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Ian\", \"Dundas\", 47000);"); if(sda.hasError()) { } else copyFileToAssetsFolder("quizz.db"); } } void SQLTest::copyFileToAssetsFolder(const QString fileName) { QString appFolder(QDir::homePath()); appFolder.chop(4); QString originalFileName = appFolder + "app/native/assets/" + fileName; QFile newFile(originalFileName); // If I enable this `if` condition the code satisfies it and removes the quizz.db file and then it satisfies the next `if` condition and successfully copies the quizz.db file from `data` folder to `assets` folder. /*if(newFile.exists()) QDir().remove(originalFileName);*/ // this `if` condition is not satisfied. Which should mean the quizz.db file has been created on assets folder. if (!newFile.exists()) { // If the file is not already in the assets folder, we copy it from the // data folder (read and write) to the assets folder (read only). QString dataFolder = QDir::homePath(); QString newFileName = dataFolder + "/" + fileName; QFile originalFile(newFileName); if (originalFile.exists()) { // Create sub folders if any creates the SQL folder for a file path like e.g. sql/quotesdb QFileInfo fileInfo(originalFileName); QDir().mkpath (fileInfo.dir().path()); if(!originalFile.copy(originalFileName)) { qDebug() << "Failed to copy file to path: " << originalFileName; } } else { qDebug() << "Failed to copy file data base file does not exists."; } } // mSourceInDataFolder = newFileName; } If activate the commented "If" condition of "copyFileToAssetsFolder" int he removes already created quizz.db file in the current folder (that Im unable to find) and goes inside the next ' if' and copy the quizz.db created on the folder "data" of active fodler. But in any case I don't find the quizz.db in the current folder. I really need help with this quickly. Thank you.
Thanks to read this to learn why you can have an application change the assets folder: https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.d...
-
Write access to the assets folder
I have DB SQLite file liabilities. When I deploy I simply open the connection in the current folder.
In the docs it says assets folder is a single reading file and app must copy the files that need to be writable in the application data directory in the current folder.
However on Simulator and dev alpha I simply open the connection to db file in the current folder and are able read/change data in the db file and the changes are persisted between application restarts.
Will be this change in behavior on an actual release or am I missing something?
What you see is only a convenience for certain types of use during development. Signed apps do NOT have writing anywhere inside their "app" folder, which includes the current folder. You * must * copy of data / first launch, if you want to make changes to these files. Alternatively, implement a mechanism of "copy on write" if only the files that have been changed in fact never get copied, of course, which is more complicated.
-
Spry Assets folder do not upload to the remote server
Hello
I did a Spry menu bar that makes its own Assets folder, but when I try to download it to the remote server it comes up with an error to say that
"1 file is incomplete" and that it cannot download. " Any suggestions? I have read through so many forums and just can't find answers. Thank you.
You can try to put the file ubto in the directory root (without the subdirectory).
-
Dreamweaver CS5 Spry Assets folder still a problem!
OK - I think I've read all the discussions and the answers to the problem with DW 5 do not recognize the path to the folder assets spry (WARNING: The Spry active folder is not inside the site.) Please select a valid folder in the root of your local site"). I'll still have a problem with this and impossible to define a new site! I named my HD, placed the site in the applications folder and selected to make sure that the path is correct. Still no luck. Is there something else going on here that I missed. Thank you!
- Try to burn your website on a cd or create a your site .iso image and mount it with editing etc. (for xp Daemon Lite...) software
- To add the site from the cd
- If there is no error message, then rename your hard drive should certainly do the trick
- But if there is an error message, so I don't KNOW, maybe DW can't read the right directory or something...
- Try to change the drive as "G:" of TEST ONLY letter, then go back!
-
Copy of the base to the assets folder directory
Hello
I created a database by using the following code
bool dbHelper::CreateDataBase() { QSqlDatabase database = QSqlDatabase::addDatabase("QSQLITE"); bool success = false; database.setDatabaseName("./data/duDatabase.db"); if (database.open()) { alert(tr("Database created/registered.")); success = true; } else { const QSqlError error = database.lastError(); alert(tr("Error opening connection to the database: %1").arg(error.text())); } database.close(); return success; }
Now, using the "target file system browser" I see my DB inside the file data in the sandbox
My problem is:
I want to copy this DB to the folder active (I want to use as the source for a data source).
How can I do that. Please help me with a code
GOD is OK, but to the point of Curahee quotes example shows you how to use a sqlite data source database:
https://github.com/BlackBerry/Cascades-samples/tree/master/quotes
It is quite easy to use the CustomSqlDataSource class with your own SQL query
-
How to transfer files to a specific folder (or root) instead of the Assets folder?
Is it possible, or should I go ahead and fill a feature request?
Hello
You can set a folder so that the download site and the full site will be downloaded to this folder. However, it is not possible to download a particular file in a specific folder.
Kind regards
Aish
-
Problem: The spry assets folder is not in the site?
However there are. I aux.1 the SpryAssets folder in the local site folder. and I still got the same message Hauptstr
Hi Denis,.
Thank you to write in English, you will get more results in this English speaking forum. On the other hand, has ever tried to get a response in the French forum?
And, please consider this request and read the announcements at the top of this page in front of all threads in DW: How Important is the Code? A call using our new posters share!
http://forums.Adobe.com/thread/691654?TSTART=0
Or better send us your link to your website in question (regardless of how it looks).
A first clue might be anyway to control, if you have downloaded all the necessary for your server (*.css, *.js, aso) spry files.
Hans G.
-
I have created a new element of library and saved in the folder of the library of my site. When I click on the active tab in my Control Panel files, I don't see the new library item saved. What I am doing wrong. I'm fairly new to Dreamweaver.
CindyI did as you suggested NOW and selected the element, and then change, library, add an item to the library. IT WORKED!
Thank you very much.
-
Copy the file to the current folder using QFile
Hi, I'm not too familiar with C++ and how bb10 manages the file system, and I'm trying to save the phone for assets app folder
I've searched the forums and this is what I have so far
QFile::copy(QDir::currentPath() + fromPath, QDir::currentPath() + toPath);
where fromPath is the selectedFile from the picture picker (/ accounts/1000/shared/camera/IMG_00000151.png) and toPath is the path that I've specified (/ app/native/assets/pictures/IMG_00000151.png)
The problem is, QDir::currentPath() is back - /accounts/1000/appdata/com.example.TestApp.testDev_ple_TestApp96d891e_
Thus, the copy of the path becomes
/Accounts/1000/APPDATA/com.example.TestApp.testDev_ple_TestApp96d891e_/accounts/1000/shared/camera/IMG_00000151.PNG
So I modified the fromPath to remove ' / accounts/1000 "so that the copy of the path becomes
/Accounts/1000/APPDATA/com.example.TestApp.testDev_ple_TestApp96d891e_/shared/camera/IMG_00000151.PNG
But it does not save yet. My question is, what should the copy of the path and fromPath look like?
Sorry for this noobish question.
I didn't notice you are trying to copy the current file. Assets folder is read-only (at least on the device Simulator it is possible to write in it). Use data / folder instead, it is read-write, but is deleted if the application is uninstalled.
-
I have the 'assets' above 'src' folder folder where the .fla file is. The assets folder is included through air iOS publish setting in Adobe Flash Professional CS6, but I'm having trouble accessing it.
the directory structure looks like this. Main.As is the class of document for my project.
c:
/project
/assets
/bin
/lib
/src
/Main.as
/Main.flaNow, if the project was a project of action script, I can normally access the assets folder using a path like "... / assets. But it says in the Air for iOS project, that the file is not there.
In the iOS Air publish setting window, it indicates the path to the included file is 'c:\project\assets' while when I move the active folder under folder src, he says just 'active' and then it can be accessed simply by using a path like '\assets '.
Does anyone have an idea where the included file?
It was that I had to simply put "/" in front of the track. I was able to access the directory of iOS using ' / assets "instead of just"active "... I still need to use ' c: / project/assets "to access the directory from my local pc from my directory the document root is ' c: / project/assets/src" but I guess that's no big deal. Thanks for your advice.
-
HP Envy Sleekbook 6-1019NR: HP Envy Sleekbook 6-1019NR brick HELP!
RE: HP Envy Sleekbook 6-1019NR brick HELP!
Hello guys,.
Seems to my laptop was bricked during the BIOS update.
I searched the web for hours, looking for a solution with no result.
I hope I can get help here.
Thanks in advance.INFORMATION SYSTEM (At the time of update/being in bricks)
Model : HP Envy Sleekbook 6-1019NR
Start-up : internal hard drive as primary
OS : newly installed Windows 7 Ultimate 64 bit
Pilot : all drivers have been updated from the HP website.
Note : hard disk has been whipped clean (formatted) everything (including the HP files pre-installed) and repartitioned in to a single partition since day 1. Even with all the changes to the hardrive, it worked fine.State of PLAY (After the BIOS SP60727. EXE update from the HP website)
1. laptop powers
2. the light stays on
3 Caplock light has two long flashes
4. fan works
5. the screen remains off (no display of any kind at any time when laptop is turned on)USB TESTING (Another HP laptop in good health during the tests, battery and power cord were not disconnected)
Model : HP Envy 14-2000
Boot : USB as primary
OS : newly installed Windows 7 Ultimate 64 bit
Pilot : all drivers have been updated from the HP website.
Note : hard disk has been whipped clean (formatted) everything (including the HP files pre-installed) and repartitioned in to a single partition since day 1. Even with all the changes to the hardrive, everything works fine.
1. bootable USB BACK was made with "HP USB Disk Storage Format Tool"
2. downloaded "" SP60715. "» "EXE" from the HP Web site (even as it is installed)
3. using 7 - Zip, file '03385.fd' has been extracted from "" SP60715. "» EXE ".
4. '03385.fd' file has been saved to USB
5 USB is connected to the laptop
6. when turned on without having any pressure on the buttons, BACK loading with '03385.fd' in the folder root when the "DIR" command was used.
7 and now the 'Windows' + 'B' button > switch on/offscreen stays off
power light stays on
WiFi stays on (orange)
Caps lock flashes in the meantime a flashing continuously
USB flashing in an interval long continuous flashing
Laptop was in this State for 30 + minutes with out any changes
Has been turned off manually, USB has been removed, power has been repressed manually.
(Fingers crossed that I don't have just F #& K another computer LAPTOP)
Laptop started right windows, looked just as before the test system.
Could not say if this trial did nothing at all, but I guess if reinstalling the BIOS has been made successfully, this is what it should be?
USB FINAL PREPARATION
1. bootable USB BACK was made with "HP USB Disk Storage Format Tool"
2. downloaded "" SP60727. "» "EXE" from the HP Web site
http://support.HP.com/us-en/drivers/selfservice/HP-envy-Sleekbook-6-1000/5269347/model/5286450#Z7_30...
3. using 7 - Zip, "018DE. BIN file"was extracted from" "SP60727."» EXE ".
4."018DE. BIN "file to USBWHICH HAS BEEN TESTED
Note : battery and power cord was unplugged, power duraining in now the power button for 30 + dry before plugging the power cord was made every time for all of the following
1. the CCMOS reset unplug and plug back the CMOS battery for 5 + mins
2. the cord connecting > keeping 'Windows' + 'B' button > switch on/off
3. 'Windows' + 'B' holding down > connecting the power supply cord > turn
4 while now the 'Windows' + 'B' button > plugging the power cord > power on/off (hold the power button down for 5 seconds)
5 connected USB bootable BACK > keeping 'Windows' + 'B' button > plugging the power cord > turn
6 connected USB bootable BACK > keeping 'Windows' + 'B' button > plugging the power cord > power on/off (hold the power button down for 5 seconds)I missed or not doing something correctly?
====================================
Update 1511031825
I've done some research more and right now, that's how I've got.
1 USB has been named as HP_TOOLS
2 within the USB, directories must be performed as Hewlett-Packard/BIOS/current
3. in the "Assets" folder, I have files '018DE.bin' and '018DE.sig '. These files were backup of the original HP HP_TOOLS within this portable partition before I deleted.
RESULT : Laptop load screen of the BIOS update, but the update will fail with the note saying "BIOS recovery system has no" 'could not open the BIOS image file.
Any ieads on that?
I did some research more and was able to put the pieces together to get this problem solved my self.
Laptop is now running. Yay!
-
suggest correct PDF taget IDs to call the pdf file!
Hello I want to open the pdf file that is stored in my assets folder. I implemnted the with th http://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/adobereader... refernce this link.but when I run the application it gives me no targets were found error.how to solve the error? pls help... Here is my code
Application of InvokeRequest;
m_invokeManager = new InvokeManager (this);request.setTarget ("com.rim.bb.app.adobeReader");
request.setAction ("bb.action.OPEN");
request.setMimeType("application/pdf");
QString = uri
'file:///accounts/1000/shared/documents/pdf-sample.pdf ';request.setUri (uri);
answer = m_invokeManager-> invoke (request);
QObject::connect (response, SIGNAL (finished (()), this, SLOT (myInvokeReplySlot ()));Thank you
Install the latest leak of 10.3.0.11052 to the alpha of dev and you will have Adobde too.
or just install Adobe Reader only
-
reproduce the error login name and after application crash
Hello
I have attached the code that generates the duplicate connection name error and after they crash the application.
Note :-in app when you press tab 3 at that point they extract data and once you press tab 3 then app crash,.
So please update me as soon as possible.
Thank you
Umang.
Still awaiting response that you will find attached code or I also include the code here
QML
// Default empty project template import bb.cascades 1.0 TabbedPane { id: tabMeniuNavigation //showTabsOnActionBar: true Tab { title: qsTr("All") id: tab1 Page { Container { // define tab content here Label { text: qsTr("Tab1") horizontalAlignment: HorizontalAlignment.Center textStyle { base: SystemDefaults.TextStyles.TitleText } } } } } Tab { id: tab2 title: qsTr("Tab2") Page { Container { // define tab content here Label { text: qsTr("Tab2") horizontalAlignment: HorizontalAlignment.Center textStyle { base: SystemDefaults.TextStyles.TitleText } } } } } Tab { id: tab3 title: qsTr("Tab3") content: Page { Container { ListView { objectName: "otherNoteListView" } // ListView } } onTriggered: { app.medicialListData(); } } Tab { id: tab4 title: qsTr("Tab4") Page { Container { // define tab content here Label { text: qsTr("Tab 4") horizontalAlignment: HorizontalAlignment.Center textStyle { base: SystemDefaults.TextStyles.TitleText } } } } } Tab { id: tab5 title: qsTr("Tab5") Page { Container { // define tab content here Label { text: qsTr("Tab5") horizontalAlignment: HorizontalAlignment.Center textStyle { base: SystemDefaults.TextStyles.TitleText } } } } } onCreationCompleted: { // this slot is called when declarative scene is created // write post creation initialization here console.log("TabbedPane - onCreationCompleted()") // enable layout to adapt to the device rotation // don't forget to enable screen rotation in bar-bescriptor.xml (Application->Orientation->Auto-orient) OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; } }
CPP
// Default empty project template #include "FindMedicin.hpp" #include "customListMedicinitemfactory.h" #include
#include #include #include using namespace bb::cascades; using namespace bb::data; FindMedicin::FindMedicin(bb::cascades::Application *app) : QObject(app) { // create scene document from main.qml asset // set parent to created document to ensure it exists for the whole application lifetime QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("app", this); // create root object for the UI root = qml->createRootObject (); // set created root object as a scene app->setScene(root); } FindMedicin::~FindMedicin() { QSqlDatabase::removeDatabase(mDbNameWithPath); delete medicinListView; model->registerUserData(); } QString FindMedicin::copyFileToDataFolder(const QString fileName) { // Since we need read and write access to the file, it has // to be moved to a folder where we have access to it. First, // we check if the file already exists (previously copied). QString dataFolder = QDir::homePath(); QString newFileName = dataFolder + "/" + fileName; QFile newFile(newFileName); if (!newFile.exists()) { // If the file is not already in the data folder, we copy it from the // assets folder (read only) to the data folder (read and write). QString appFolder(QDir::homePath()); appFolder.chop(4); QString originalFileName = appFolder + "app/native/assets/" + fileName; QFile originalFile(originalFileName); if (originalFile.exists()) { // Create sub folders if any creates the SQL folder for a file path like e.g. sql/quotesdb QFileInfo fileInfo(newFileName); QDir().mkpath(fileInfo.dir().path()); if (!originalFile.copy(newFileName)) { qDebug() << "Failed to copy file to path: " << newFileName; } } else { qDebug() << "Failed to copy file data base file does not exists."; } } return newFileName; } //Find Pharama void FindMedicin::medicialListData() { CustomListMedicinItemFactory *otherNoteItemFactory = new CustomListMedicinItemFactory(); qDebug() << "MediaList Data Called."; // create a data model with sorting keys for firstname and lastname model = new GroupDataModel(QStringList() << "field1"); mDbNameWithPath = copyFileToDataFolder("sql/FindMedicin.db"); // load the sql data from contacts table SqlDataAccess sda(mDbNameWithPath); //sda = new SqlDataAccess(mDbNameWithPath, this); if (sda.hasError()) { DataAccessError err = sda.error(); //DataAccessError* err = sda.error(); qWarning() << "SQL error: type=" << err.errorType() << ": " << err.errorMessage(); } QVariant list = sda.execute("select * from medicin_detail"); // add the data to the model qDebug() << list.value (); model->setGrouping(ItemGrouping::None); model->insertList(list.value ()); // create a ListView control and add the model to the list medicinListView = root->findChild ("otherNoteListView"); medicinListView->setObjectName(""); medicinListView->setDataModel(model); medicinListView->setListItemProvider(otherNoteItemFactory); } more code as an attachment.
-
Version of App problem, help.
I developed an application with basic reading and writing (access SQLData) data.
on Debug or Run it works perfectly, but when I'm creating a release and run the bed application only from the database.
Something like that...
bool DbHelper::copyDbToDataFolder(const QString databaseName) { // Since we need read and write access to the data base it has // to be moved to a folder where we have access to it. First // we check if the file already exists (previously copied) QString dataFolder = QDir::homePath(); QString newFileName = dataFolder + "/" + databaseName; QFile newFile( newFileName ); if (!newFile.exists()) { // If the file is not already in the data folder we copy it from the // assets folder (read only) to the data folder (read and write). // Note that on a debug build you will be able to write to a data base // in the assets folder but that is not possible on a signed application. QString appFolder(QDir::homePath()); appFolder.chop(4); QString originalFileName = appFolder + "app/native/assets/sql/" + databaseName; QFile originalFile( originalFileName ); if (originalFile.exists()) { return originalFile.copy(newFileName); } else { qWarning() << "Failed to copy file, database file does not exist."; return false; } } return true; }
Maybe you are looking for
-
Satellite A100-649: upgrade to 250 GB - bad HARD disk size reported
Hello Have big problems to insert a new hard drive up to 250 GB.(Samsung S - ATA)The hard drive is recognized by the Windows XP installation in the right size. In the partitionscreen by installing XP blue only 136 GB are indicated. Please help me!Vik
-
I get an email from Microsoft telling me that I need to confirm my account hot mail or it will be turned off. They ask my name, age, e-mail address and password. Is it a scam?
-
Not computer smart like most... self-taught through the HELP screen... stayed in this 3-4 days now? Help!
-
CD installation lost, security documents and all that...
Some time ago I noticed that I could have thrown all my "papers of computer... Boxes with documentation and warranty... Warranty was already obsolete, but I had there also my cd of Vista Home Premium, I bought with a computer (extra charge). Now, I i
-
Why this example has this error "Scroll for available commands" on Bold 9780 or 9650? import net.rim.device.api.ui.*;import net.rim.device.api.ui.container.*;import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.component.table.*;publ