If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
New Contributor
pkinsman28
Posts: 2
Registered: ‎04-20-2013
My Device: Blackberry Z10
My Carrier: T-Mobile

Please help me with my invocation

I am trying to write an app that will open a PDF file when a button is pressed. I would like to have it invoke Adobe Reader to open the file. I can not get it to work. Ive tried all kinds of different things, i can invoke the share action and i can invoke nfc as well but no matter what i try i cannot get it to open a pdf file. Ive tried bound invocation and unbound as well.

 

Im starting to think it may be the way im trying to link the URI, maybe im not accessing the location correctly, I have the pdf file located in my "assets" folder. I am including my code so far, any help would be greatly appreciated, ive been knocking my head against the wall over this one for a while now and I cant find anything on the web to help.

 

// Default empty project template
import bb.cascades 1.0

// creates one page with a label
Page {
    Container {
        layout: DockLayout {}
        Label {
            text: qsTr("Lets get Started!")
            textStyle.base: SystemDefaults.TextStyles.BigText
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center
        }
        Button {
           id: invoker
            attachedObjects: [
                Invocation {
                    id: invokepdf
                    query: InvokeQuery {
                        id: invokeQuery
                       

                    }
                    onArmed: {
                        if (invokeQuery.uri != "") {
                            trigger("bb.action.OPEN");

                        }
                    }
            }
                ]
            

            onClicked: {
                
                invokeQuery.mimeType = "application/pdf"
                invokeQuery.uri = "file:///app/native/assets/myPDFFile.pdf";
                invokeQuery.updateQuery();
                

            }
        }
       
    }
}

 

I have tried with and without declaring the invoke targetID, no matter what I try when I press the button nothing happens. Is there something I need to do in the cpp and hpp files? Im very new to development of any kind, I know just the very basics. Please help me out!:Helpsmilie:

Please use plain text.
Developer
shahumang8
Posts: 580
Registered: ‎08-09-2010
My Device: Not Specified

Re: Please help me with my invocation

Hi Pkinsman28,

 

      Please follow below link.

 

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

 

      After still you get same problem so let me know.

 

Regards,

Umang.

 

-------------------------------------------------------------------------------

 

feel free to press the like button on the right side to thank the user that helped you.

Please use plain text.
New Contributor
pkinsman28
Posts: 2
Registered: ‎04-20-2013
My Device: Blackberry Z10
My Carrier: T-Mobile

Re: Please help me with my invocation

I have included the invoke target id along with all the other parameters for Adobe Reader but still when I press the button I get nothing. This is very frustrating, I just can not get this to work. Im wondering if I need to do something with the PDF file itself or somehow make the location known to the app. I don't know. Thank you for the help.

Please use plain text.
Developer
StevenKader
Posts: 635
Registered: ‎02-03-2010
My Device: Z10 LE
My Carrier: Rogers

Re: Please help me with my invocation

I understand your fustration.   The problem is that we can't change the uri dynamically in QML.  It needs to be done in C++.  Take a look at my sample project ShareFile  : https://github.com/blackberry/Cascades-Community-Samples/tree/master/ShareFile    to see how you can get it working.


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Please use plain text.
Developer
StevenKader
Posts: 635
Registered: ‎02-03-2010
My Device: Z10 LE
My Carrier: Rogers

Re: Please help me with my invocation

I see you have a fixed file name.  You could also try putting the definition of  uri above when you create the invoke query instead of trying to update it.


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Please use plain text.