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

Web and WebWorks Development

Reply
Developer
shanerooni
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
Accepted Solution

filereader

hello -

having the worst trouble implementing filereader on my playbook app.  i have the following in my config file:

 

<rim: permissions>
        <rim: permit>access_shared</rim: permit>
        <rim: permit>record_audio</rim: permit>

</rim: permissions>

 

so i figured i was okay with the permissions.  kitchensink says to add <permission>access_shared</permission> in the bbwp\AirAppTemplates\src\blackberry-tablet.xml file. not sure what that means since that is in the SDK directory and not in my packaged zip file.

 

is the way i add the permission to the config file correct?

 

the problem i have is when i port the code for filereader to my app, and i click the input's 'Choose Files' button, nothing happens.  in chrome - my testbed - it works fine which tells me the code works, but maybe the permission doesn't.  i can't imagine why it won't pull up the file explorer.  i'm just having the user choose music files to integrate into the app, so i basically need the file explorer to pull up so i can get the filename once they select the song they want.

 

any help would be appreciated. after 4.5 hours of just trying to get this working last night, any help would be greatly appreciated!

Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: filereader

Hi. The way you added the permission isn't completely correct. From your example you have:

 

<rim: permissions>
    <rim: permit>access_shared</rim: permit>
    <rim: permit>record_audio</rim: permit>
</rim: permissions>

I marked/underlined the items that could cause your issues and you should use this instead:

 

<rim:permissions>
    <rim:permit>access_shared</rim:permit>
    <rim:permit>record_audio</rim:permit>
</rim:permissions>

 Give this a try.

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: filereader

And some more thing to remember. To access the shared folder on the device you need the access element in the config.xml like this one:

 

// grant access to "everything" local+online
<access subdomains="true" uri="*" />

 

 

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
shanerooni
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook

Re: filereader

[ Edited ]

i'll take a look at this second point when i get home tonight.  i should have mentioned i added the space intentionally in the post so it wouldn't turn : p into :smileytongue:

 

i guess i should use the code sections!

 

thanks!

Developer
shanerooni
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook

Re: filereader

[ Edited ]

the problem was with event.preventDefault in document.ontouchstart.  is there a way to only prevent certain events.  i want the input button to fire up the file browser, but i don't want my css3 buttons' text to be selected when i push those buttons.  is there a way to do an if statement based on the event coming into the ontouchstart function?

 

***UPDATE***

 

used the following:

 

document.ontouchstart = function(event)
{
     if(event.target.id != 'txtFile') event.preventDefault;
}

 this allows me to just identify the 'Choose File' button from the input, and since the default isn't prevented i'm able to ignore everything else, but still bring up the file explorer.