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
Posts: 35
Registered: ‎12-20-2012
My Device: Limited Edition Z10
My Carrier: Telekom Slovenije
Accepted Solution

Invoke timer in QML

Hi,

I have a problem with invoking core application Clock in QML.

This is my code:

        ActionItem {
            title: "Set Timer"
            imageSource: "asset:///images/Timer.png"
            ActionBar.placement: ActionBarPlacement.OnBar
            onTriggered: {
                timer.trigger("bb.action.VIEW");
            }
            attachedObjects: [
                Invocation {
                    id: timer
                    query {
                        invokeTargetId: "bb.clock.launcher"
                        mimeType: "text/plain"
                        data: "timerTab"
                    }

                }
            ]
        }

 This is what I get in console:

InvocationWrapper:Smiley SurprisednQueryFinished: no matching result from Menu Service for query
mimeType="text/plain"
uri=QUrl("")
data= "timerTab"
metadata= QMap()
perimeter= 0
action= ""
target= "bb.clock.launcher"
invokerIncluded= false
InvocationPrivate:Smiley SurprisednQueryResolved: no result matching query, no armed signal sent.

 

Did I forget to set some sort of permission or include library?

 

This is page with required attributes for invoking Clock app

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/clock.html

 

I'm using 10.1.0.4633 SDK

 

______________________________________________________________
Check my Apps http://appworld.blackberry.com/webstore/vendor/29747/?lang=en
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Invoke timer in QML

You might need to include the invokeActionId: "bb.action.VIEW" on the InvokeQuery ahead of time, so it can resolve the request properly. It's a "wart" that you have to put it there (at least sometimes) as well as supplying it in the Invocation.trigger call. What I do to reduce the duplication is (using your example), timer.trigger(timer.query.invokeActionId);

I'm not sure this will work, but it appears this form of invocation always requires that the broker can resolve the request fully ahead of time, and if it's missing a required piece (e.g. the action) it can't do that. I haven't used Clock yet but this has been the situation in other cases.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 35
Registered: ‎12-20-2012
My Device: Limited Edition Z10
My Carrier: Telekom Slovenije

Re: Invoke timer in QML

Thx for reducing duplication tip.  Smiley Happy

 

After putting action in query still doesn't work:

 

InvocationWrapper:Smiley SurprisednQueryFinished: no matching result from Menu Service for query
mimeType="text/plain"
uri=QUrl("")
data= "timerTab"
metadata= QMap()
perimeter= 0
action= "bb.action.VIEW"
target= "bb.clock.launcher"
invokerIncluded= false
InvocationPrivate:Smiley SurprisednQueryResolved: no result matching query, no armed signal sent.

 

 

______________________________________________________________
Check my Apps http://appworld.blackberry.com/webstore/vendor/29747/?lang=en
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Invoke timer in QML

Unfortunately this could be yet another case where supplying the "data" property on an InvokeQuery in QML doesn't work. There are other threads where the same situation arises with invoking the email composer, and phone dialer.

The only solution I've come up with so far is to use C++ for this. See Shadid's post here for an example of doing it for email (http://supportforums.blackberry.com/t5/Native-Development/Invoke-Email-with-Attachment/m-p/2251453#M...

 

Note the use of PpsObject::encode(), which may be a required part of the puzzle, although with a simple string required for the data in this case (e.g. "timerTab") that may not be required. It's unclear, and basically undocumented. They never really intended to expose any of the PPS stuff to us, so these cases are likely all places where the APIs are lacking and different hacks are needed to gloss over the gaps.  (Note that all the encode() call is doing is converting the string to a byte array, and preprending "data:json:" to it, and perhaps adding a newline at the end (which is required at least in the email case).)


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Invoke timer in QML

I'm also doing all this stuff from C++

to avoid 'data' problems

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 35
Registered: ‎12-20-2012
My Device: Limited Edition Z10
My Carrier: Telekom Slovenije

Re: Invoke timer in QML

Ok, then solution is C++, thanks guys. 

______________________________________________________________
Check my Apps http://appworld.blackberry.com/webstore/vendor/29747/?lang=en
Developer
Posts: 163
Registered: ‎12-06-2012
My Device: Z10, Q10
My Carrier: BlackBerry

Re: Invoke timer in QML

Hi. I can't seem to do this even from C++. Getting no Target error. This is the thread I posted my code
http://supportforums.blackberry.com/t5/Native-Development/Can-t-invoke-the-clock-app/m-p/2654465
Thanks.
Highlighted
Developer
Posts: 1,163
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Invoke timer in QML

[ Edited ]

Try it with my Invoker class... free to use as you like. Should make the job much easier for you. Unlike the C++ only solutions Invoker can also be called from QML, and it solves the InvokeQuery bug in BB10.2 as well.

 


calicratis19 wrote:
Hi. I can't seem to do this even from C++. Getting no Target error. This is the thread I posted my code
http://supportforums.blackberry.com/t5/Native-Development/Can-t-invoke-the-clock-app/m-p/2654465
Thanks.





Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.