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

Native Development

Reply
Developer
robertopne123
Posts: 27
Registered: ‎06-23-2014
My Device: Blackberry Z10
Accepted Solution

Downloading feeds to .mp3 files

Hello, I have tested some feeds in the app that I have and I can click on them, but they open up in the browser. How would I go about downloading the files as an .mp3 file on the devices SD Card.
 
I am totally stuck with this part, but I have this code for my "main.qml":
 
 
/*
 * Copyright (c) 2011-2013 BlackBerry Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
import bb.cascades 1.2
 
NavigationPane {
    id: navigationPane
 
    Page {
        
        titleBar: TitleBar {
            // Localized text with the dynamic translation and locale updates support
            title: qsTr("PocketPod 10") + Retranslate.onLocaleOrLanguageChanged
        }
 
        Container {
            background: Color.Black
            Button{
                maxWidth: 100.0
                translationY: 10.0
                imageSource: "asset:///in_app_icons/ic_reload.png"
                onClicked: {
                    _app.load("feeds.xml")
                }
 
 
            }
            ListView {
                topMargin: 50
                dataModel: XmlDataModel {
                    id: rss
                    source: "feeds.xml"
                }
                
                listItemComponents: [
                    ListItemComponent {
                        type: "feed"
                        
                        SettingsListItem {
                        
                        }
                    }
                ]
               
 
            }
            
        }
        
        
 
        actions: ActionItem {
            title: qsTr("Add Feeds") + Retranslate.onLocaleOrLanguageChanged
            ActionBar.placement: ActionBarPlacement.Default
 
            onTriggered: {
                navigationPane.push(secondPageDefinition.createObject());
            }
        
        }
        
    }
 
    attachedObjects: [
        // Definition of the second Page, used to dynamically create the Page above.
        ComponentDefinition {
            id: secondPageDefinition
            source: "DetailsPage.qml"
        }
    ]
 
 
    onPopTransitionEnded: {
        // Destroy the popped Page once the back transition has ended.
        page.destroy();
        
    }
    
}

 Thanks in advance

Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Downloading feeds to .mp3 files

Again there is a http file download sample that you can look at.

 

Or a simple search would have quickly led to this example...

 

http://supportforums.blackberry.com/t5/Native-Development/How-to-download-zip-file-And-also-open-ext...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.