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
Regular Contributor
sandeshmsg
Posts: 64
Registered: ‎06-16-2011
My Device: bold 9000, playbook
My Carrier: vodafone
Accepted Solution

Playbook Path help.

Hello Sir/Ma'am,

 

please tell me the absolute path to the media directory in playbook . I want to access wallpapers, downloaded images etc.. please help me . I am badly stuck. 

 

 

Thnaks in Advance,

Sandesh.

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Playbook Path help.

Hi sandeshmsg,

 

I would reccomend using the blackberry.io.appDirs (http://www.blackberry.com/developers/docs/webworks/api/blackberry.io.dir.html#.appDirs^2) method and get the path you're interested in. To better see the structure  of the returned data check out the URI version of the API (http://www.blackberry.com/developers/docs/webworks/api/blackberry.io.dir.html#.appDirs)



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Regular Contributor
sandeshmsg
Posts: 64
Registered: ‎06-16-2011
My Device: bold 9000, playbook
My Carrier: vodafone

Re: Playbook Path help.

Thanks but I am not able to find the media folder . can you please tell me the full path. like file:/// .....

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Playbook Path help.

Does this code not work for you? Make sure your config has both the featureIDs and the permission tags set up

 

<script type="text/javascript">
  var dirs = blackberry.io.dir.appDirs;
	
  alert('Application storage folder path:' + dirs.app.storage.path);
		
  // access_shared permission must be added in order to access shared folders
  var musicDir = dirs.shared.music.path;
  alert('Music folder path:' + musicDir);
</script>

 The full strucure of the returned data will look like this, so just use the corresponding key for the type of data you're looking for.

{
  "data" : {
    "app": {
      "storage" : {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/data"
      }
    },
    "shared": {
      "bookmarks": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/bookmarks"
      },
      "books": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/books"
      },
      "camera": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/camera"
      },
      "documents": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/documents"
      },
      "downloads": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/downloads"
      },
      "misc": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/misc"
      },
      "music": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/music"
      },
      "photos": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/photos"
      },
      "print": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/print"
      },
      "videos": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/videos"
      },
      "voice": {
        "path" : "file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/voice"
      }
    }
  }
}

 

 

 



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Regular Contributor
sandeshmsg
Posts: 64
Registered: ‎06-16-2011
My Device: bold 9000, playbook
My Carrier: vodafone

Re: Playbook Path help.

Only first alert statement is getting executed. Not second one .

my config.xml content is...

 

<?xml version="1.0" encoding="UTF-8"?><widget xmlns="http://www.w3.org/ns/widgets
xmlns:rim="http://www.blackberry.com/ns/widgets" version="2.0" rim:header="RIM-
Widget:rim/widget">

  <name>Hello World</name> 

   <description>Sample app.</description>

   <author rim:copyright="2011">Sandesh</author>

   <icon rim:hover="false" src="icon.png"/>

   <icon rim:hover="true" src="icon.png"/> 

   <content src="index.htm"/>

   <feature id="blackberry.io.dir" /> 

   <rim:smileytongue:ermit>access_shared</rim:smileytongue:ermit>

 </widget>

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Playbook Path help.

Hi sandehmsg,

 

I guess this needs to be more clear, but the permits tag have to be inside of a permissions element. If it works you'll get a pop-up when you start the app.

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

 

 



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Regular Contributor
sandeshmsg
Posts: 64
Registered: ‎06-16-2011
My Device: bold 9000, playbook
My Carrier: vodafone

Re: Playbook Path help.

How can i miss that :smileysad: .....:smileysad: 

 

Thanks a lot its working now . 

Please use plain text.