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
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
Accepted Solution

Opening a system setting from within an app

Hello, 

 

I have been going by this documentation: https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/settings.h...

 

I have tried using both buttons and actionitems but neither seem to open the specified system settings page. 

 

import bb.cascades 1.0
import bb.system 1.0

TabbedPane {
    showTabsOnActionBar: false
    Tab { //First tab
        // Localized text with the dynamic translation and locale updates support
        title: qsTr("Tab 1") + Retranslate.onLocaleOrLanguageChanged
        Page {
            titleBar: TitleBar {
                title: "Development Mode"
            }
            actions: [
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.OnBar
                    title: "Open Dev Mode"
                    attachedObjects: [
                        Invocation {
                            id: invokeDevMode
                            query {
                                invokeTargetId: "sys.settings.card"
                                invokeActionId: "bb.action.OPEN"
                                mimeType: "settings/view"
                                uri: "settings://devmode"
                            }
                        }
                    ]
                    onTriggered: {
                        invokeDevMode.trigger("bb.action.OPEN")
                    }
                }
            ]

        }
    } //End of first tab
    Tab { //Second tab
        title: qsTr("Tab 2") + Retranslate.onLocaleOrLanguageChanged
        Page {
            Container {
                Label {
                    text: qsTr("Second tab") + Retranslate.onLocaleOrLanguageChanged
                }
            }
        }
    } //End of second tab
}

 Any help would be greatly appriciated 

Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: Opening a system setting from within an app

[ Edited ]

its not the button or action item route, it's likely the query.  There's been issues using invocation queries since day one and for the forseeable future.

 

To get around this you can do the invocation from c++, thus far they have not quit working with every os update.

 

GreenMr published a great class that will handle really any type of invocation nicely

 

http://supportforums.blackberry.com/t5/Native-Development/InvokeActionItem-10-2/m-p/2648281#M51662

 

You can integrate this so that it can be called from qml so really the only c++ work that needs to be done is copying the code into your app

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

Re: Opening a system setting from within an app

[ Edited ]

You won't be able to open your own apps settings page the closest you can get is the permission page listing all apps.

 

            Button {
                text: "Check Application Settings (QML)"
                onClicked: { invokeSettings.trigger("bb.action.OPEN") }
                
                attachedObjects: [
                    Invocation {
                        id: invokeSettings
                        // query.invokeActionId: "bb.action.OPEN"
                        query.uri: "settings://permissions"
                        query.invokeTargetId: "sys.settings.target"
                    }
                ]
            }

 


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.
Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: Opening a system setting from within an app

Sorted it; played around with your code a little bit and I got it to work - thanks for your help :smileyhappy: