How to Transfer Files To or From an Application's Sandboxed File Area

by BlackBerry Development Advisor on ‎08-19-2011 02:15 PM (3,063 Views)

The BlackBerry® Tablet OS SDK for Adobe® AIR® 1.1.0 release adds a feature that lets you easily retrieve a file from or send one to the BlackBerry® PlayBook™ tablet if you have a devMode app installed.


Here's the basic syntax:


blackberry-deploy -getFile REMOTE_PATH LOCAL_NAME -device PBIP -password
PBPASS -package

The REMOTE_PATH part is effectively relative to File.userDirectory for your app.  See the File System Layout article for more on that.  This means that to get data from your applicationStorageDirectory area, i.e. the app's "own" data, you'd want to use something like "data/mydatabase.db" (for example for a SQLite database you created with the package).


LOCAL_NAME is just what you want the file to be named when it's transferred to your development computer.  It would be written into the current directory if you don't specify a full path. 


PBIP and PBPASS are the usual you use for any blackberry-deploy command, and you can either specify the -package (a .bar file) directly as above (in which case the package name and id are pulled out of it), or a -package-name and -package-id combination, again as bb-deploy has always supported.


To transfer a file to the tabletyou use "-putFile" instead, and specify the local file first, then the target path on the PlayBook. 


Details of usage are shown if you just type "blackberry-deploy" with no arguments.