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
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)