Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Member
ab11
Posts: 1
Registered: ‎03-20-2012
My Device: playbook

Issue creating files on BlackBerry Playbook in android app?

I am running my android app on the Blackberry Playbook using RIM's eclipse plugin.

 

Files I create in the /accounts/1000/shared/documents directory are "locked" (when I browse to them and try open using the AIR browser, I get the error message "file locked). Files that I create in the /sdcard directory (the one returned by Environment.getExternalStorage) work fine. I can create and read these files programatically using the below code.

 

Any suggestions on how to create files in the documents directory which are not "locked"?

 

 

public class TempActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

try
{
File docFile = new File("/accounts/1000/shared/documents/tmp.txt");
File sdcardFile = new File(Environment.getExternalStorageDirectory().getPath() + "/tmp.txt");

FileWriter writer = new FileWriter(docFile);

try
{
writer.write("Hello doc file");
Log.i("success writing doc file", "success writing doc file");
}
catch (Exception e)
{
Log.e("exception writing doc file", Log.getStackTraceString(e));
}

writer.close();
writer = new FileWriter(sdcardFile);

try
{
writer.write("Hello sdcard file");

Log.i("success writing sdcard file", "success writing sdcard file");
}
catch (Exception e)
{
Log.e("exception writing sdcard file", Log.getStackTraceString(e));
}

writer.close();
FileReader in = new FileReader(docFile);
BufferedReader reader = new BufferedReader(in);

try
{
Log.i("firstLine in doc file", reader.readLine());
}
catch (Exception e)
{
Log.e("exception reading doc file", Log.getStackTraceString(e));
}

in.close();
reader.close();
in = new FileReader(sdcardFile);
reader = new BufferedReader(in);

try
{
Log.i("firstLine in sdcard file", reader.readLine());
}
catch (Exception e)
{
Log.e("exception reading sdcard file", Log.getStackTraceString(e));
}

in.close();
reader.close();
}
catch (Exception e)
{
Log.e("exception", Log.getStackTraceString(e));
}

}
}

 

Visitor
lholmann
Posts: 1
Registered: ‎04-25-2012
My Device: Playbook 2

Re: Issue creating files on BlackBerry Playbook in android app?

When can we expect to have an answer / workaround for the issue detailed above?


We’re selling our app on the Playbook2 and it is popular. It seems that Playbook users are grateful to find a PDF viewer and annotator working on the Playbook.


The issue mentioned above seems to be a shortcoming of the Playbook Android 'sandbox'  that we were not able to resolve.


Files created by an Android app are marked as “file locked” and cannot be accessed by other native apps.

We’re hoping that there is a workaround for it.

BlackBerry Development Advisor
jdreher
Posts: 82
Registered: ‎11-21-2008
My Device: Z10

Re: Issue creating files on BlackBerry Playbook in android app?

Hello ab11/lholmann,

 

Using the aforementioned sample class, this issue is currently under investigation.

 

 

 

James Dreher
BlackBerry Development Advisor