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
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.
New Contributor
shashwat12345
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.
Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
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.
Please use plain text.