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

Adobe AIR Development

Reply
Developer
Posts: 579
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

How to get media card directories?

There are AIR methods for getting the user directory and thus the "shared/music" directory, etc.

 

How does one:

 

A) Detect whether the media card is present?

B) Get the path to the media card's "shared/music" directory, etc.

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to get media card directories?

Use the file browser to see where that directory is. Then use the File class to resolve to that directory. You can tell if it is there by using the File class "exist" method.
Developer
Posts: 579
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: How to get media card directories?

The path seems to be:

 

/accounts/1000/removable/sdcard/music

 

How does one use the File class to resolve to such a directory?

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to get media card directories?

Try  this:

 

var dir : File = File.documentsDirectory.resolvePath( '../../removable/sdcard' );
if( dir.exists )
{
  dir = dir.resolvePath( 'music' );
  if( dir.exists )
  {
    // read music
  }
}

 Please let us know this works.

Be certain to have shared permissions set.

See if those permissions extend to this area as well.