Blackberry cfg file not found when device connects

2019-08-14 03:33发布

问题:

I am storing all the config details to a test.cfg file in my BlackBerry device. So every time when i start the application, the app will check if test.cfg exists. If it exists, then it loads all the configuration from that file and if not, the app will show the config page, then the user can enter all the config details and proceed further.

The above is working fine except one scenario. When the device is plugged in to the system and I open the Desktop Manager and the user opens the application, its directly shows the configuration page even if test.cfg already exists in the device.

Does anybody know the solution for this? or any idea why its behaving like this?

回答1:

My guess would be that when you connect your device to the computer via USB cable, your computer is mounting the SDCard as an external drive. When it does this, the device will essentially lose access to its SDCard. It needs to do this, because the device software and the desktop computer's software don't want to simultaneously be modifying the same files.

Are you saving test.cfg on the SDCard?

If so, you might want to save the file to the device's internal storage instead, for example, in the PersistentStore.

You could turn off the mass storage feature that makes your SDCard available to the PC, if you prefer to have the media card always available to the app. (if you want to do this, tell me which OS version you're using ... but, understand that this only works for you, and isn't a good solution if you want your users to avoid this problem).

You can also test for the SDCard in your app, programmatically

References

Reference on BlackBerry support forums

Data Storage Development Guide on BlackBerry.com



回答2:

Go to option -> Device -> Storage and deselect and select the media card support and save it and come out the option.Now try to access the media -> explorer folder u can able to access it and also my apps can read the file when its connecting to USB drive now.