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
Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer

INVOKE_BAD_REQUEST_ERROR while trying to open pptx file in BB10

[ Edited ]

Hi All,

 

I have to open pptx, pdf, docx files(coming from server) in my BB10 webworks application. Tried with .pptx file but getting error INVOKE_BAD_REQUEST_ERROR.

 

Below is my code:

 

blackberry.invoke.invoke( {
				target: "sys.dxtg.stg",
				action: "bb.action.OPEN",
				uri: "http://example.com/files/Test.pptx",
				type: "application/vnd.ms-powerpoint"
				//fileExtensions: ".pptx"
				
			}, onInvokeSuccess, onInvokeError );
			alert("Here...");
		}, false);

		function onInvokeSuccess(){
			alert("onInvokeSuccess ");

		}
		function onInvokeError(str){
			alert("onInvokeError "+str);

 

Feature Ids mentioned in Config.xml

 

<feature id="blackberry.app"/>
	
	<preference name="WebSecurity" value="disable"/>
	
	<access uri="http://example.com" subdomains="false" />
	<access uri="https://example1.com" subdomains="false" /> 
	
	<access uri ="*"/>
	
	<!-- Cordova API -->
  <feature id="blackberry.system" required="true" version="1.0.0.0" />
  <feature id="org.apache.cordova" required="true" version="1.0.0" />
  <feature id="blackberry.find" required="true" version="1.0.0.0" />
  <feature id="blackberry.identity" required="true" version="1.0.0.0" />
  <feature id="blackberry.identity.phone" required="true" version="1.0.0.0" />
  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
  <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0" />
  <feature id="blackberry.io.file" required="true" version="1.0.0.0" />
  <feature id="blackberry.utils" required="true" version="1.0.0.0" />
  <feature id="blackberry.io.dir" required="true" version="1.0.0.0" />
  <feature id="blackberry.app" required="true" version="1.0.0.0" />
  <feature id="blackberry.app.event" required="true" version="1.0.0.0" />
  <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
  <feature id="blackberry.widgetcache" required="true" version="1.0.0.0"/>
  <feature id="blackberry.media.camera" />
  <feature id="blackberry.ui.dialog" />
  <feature id="blackberry.connection" />
  <feature id="blackberry.bbm.platform" />
  <feature id="blackberry.invoke.card" />
  <feature id="blackberry.pim.contacts" />
  <feature id="blackberry.ui.contextmenu" />
  <feature id="blackberry.io.filetransfer" />
  <feature id="blackberry.io" />
  <feature id="blackberry.invoke" />
  <feature id="blackberry.invoked" />
  <feature id="blackberry.push" />
  <feature id="blackberry.media.microphone" required="true" version="1.0.0.0"/>

  <rim:permissions>
    <rim:permit>use_camera</rim:permit>
    <rim:permit>read_device_identifying_information</rim:permit>
    <rim:permit>access_shared</rim:permit>
    <rim:permit>read_geolocation</rim:permit>
    <rim:permit>record_audio</rim:permit>
    <rim:permit>access_pimdomain_contacts</rim:permit>
  </rim:permissions>

 

I tried many combinations in blackberry.invoke.invoke request but still not working. 

Please help. 

 

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: INVOKE_BAD_REQUEST_ERROR while trying to open pptx file in BB10

The value of the 'target' and 'action' parameters are incorrect. Is "sys.dxtg.stg" your app?  You want to launch the native apps that support these file formats (e.g. AdobeReader or DocstoGo)

 

 

How to invoke a PPT (see link for info about DOCX):

https://developer.blackberry.com/html5/documentation/v2_0/docstogo.html

 

blackberry.invoke.invoke(
{
   target: "sys.slideshottogo.previewer",
   action: "bb.action.VIEW",
   type: "application/vnd.ms-powerpoint",
   uri: "http://example.com/files/Test.ppt"
}
, function() { 
   console.log('success'); 
}, function() { 
   console.log('error'); 
});

 

 

 

How to invoke a PDF:

https://github.com/blackberry/BB10-WebWorks-Samples/blob/master/Invocation/Invoker/www/js/app.js#L27...

 

blackberry.invoke.invoke(
{
   target: "com.rim.bb.app.adobeReader",
   action: "bb.action.OPEN",
   type: "application/pdf",
   uri: "file:///accounts/1000/shared/documents/Getting Started with Adobe Reader.pdf"
}
, function() { 
   console.log('success'); 
}, function() { 
   console.log('error'); 
});

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.