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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: INVOKE_BAD_REQUEST_ERROR

[ Edited ]

Can you please give this a try? This works on my device with the standard applications and I tested with WhatsApp as well.

 

config.xml

 

<?xml version="1.0" encoding="utf-8"?>
<widget	id="com.oros.share"
		version="1.0.0.0"
		xmlns="http://www.w3.org/ns/widgets"
		xmlns:rim="http://www.blackberry.com/ns/widgets">

	<author>Oros</author>
	<name>Share</name>
	<content src="index.html" />

	<feature id="blackberry.invoke.card" />
</widget>

 

index.html

 

<!DOCTYPE html>
<html>
	<head>
		<title>Share</title>
	</head>
	<body>
		<script type="text/javascript" src="local:///chrome/webworks.js"></script>
		<script type="text/javascript">
			/*global blackberry */

			function onInvokeSuccess(msg) {
				console.log('Invocation Success: ' + msg);
			}

			function onInvokeError(msg) {
				console.log('Invocation Error: ' + msg);
			}

			function shareCardWav() {
				blackberry.invoke.card.invokeTargetPicker({
					action: 'bb.action.SHARE',
					mime: 'audio/wav',
					uri: 'local:///sound.wav',
					target_type: ['CARD']
				}, 'Share Card Sound', onInvokeSuccess, onInvokeError);
			}

			window.addEventListener('DOMContentLoaded', function () {
				document.addEventListener('click', shareCardWav, false);
			}, false);
		</script>
	</body>
</html>

 

EDIT: I ran your sample code and am hitting the same issues you describe. It must be something in the application as my device hasn't changed in any way. I tried adding the mime parameter but still no difference. I'll keep investigating here to see if I can narrow this down.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Developer
Posts: 9
Registered: ‎07-09-2013
My Device: Z10 LE
My Carrier: IDEA

Re: INVOKE_BAD_REQUEST_ERROR

Much appreciated Erik, please let me know if you find something, I'll to keep you updated if I find something here.
Highlighted
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: INVOKE_BAD_REQUEST_ERROR

The following request worked for me on the device that was previously failing:

 

var request = {
    action : 'bb.action.SHARE',
    mime : 'audio/wav',
    uri: 'local:///sounds/2.wav',
    target_type: ["CARD"]
};

Seems we need to specify the local:/// protocol explicitly.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
Posts: 114
Registered: ‎06-14-2010
My Device: Passport
My Carrier: Virgin Mobile Canada

Re: INVOKE_BAD_REQUEST_ERROR


oros wrote:

The following request worked for me on the device that was previously failing:

 

var request = {
    action : 'bb.action.SHARE',
    mime : 'audio/wav',
    uri: 'local:///sounds/2.wav',
    target_type: ["CARD"]
};

Seems we need to specify the local:/// protocol explicitly.


I know this is an older topic, but I couldn't help but notice that in the example you mention that didn't work, compared to this example the old code was

 

target_type: ['CARD']

 

with single quotes wrapping the word CARD

 

but the above code you said does work has double quotes wrapping the word CARD. Does that possibly have something to do with it

 

(I'm asking because I'm having trouble this error in my app, but under a different context)