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
Highlighted
Contributor
Posts: 17
Registered: ‎07-24-2011
My Device: Bold 8520
My Carrier: Digicel
Accepted Solution

Invoke Voice Recorder

Based on this page: http://developer.blackberry.com/html5/documentation/v2_0/voice_note.html

 

I am trying to invoke the voice recorder.  Does someone have a working example?

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

Re: Invoke Voice Recorder

[ Edited ]

Using WebWorks 2.0, I created a new project with:

 

C:\webworks> webworks create invokeRecorder

 

I then added the invoke extension:

 

C:\webworks\invokeRecorder> webworks plugin add com.blackberry.invoke

 

I cleared out the www folder to only have my index.html file (the config.xml was located in the parent folder.) My index.html file looks like so:

 

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <title>Invoke</title>
  </head>
  <body>
    <input id="doInvoke" type="button" value="Do Invoke" />
		
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript">
      window.addEventListener('load', function onload() {
document.getElementById('doInvoke').addEventListener('click', function () { blackberry.invoke.invoke({ target: 'sys.apps.audiorecorder', action: 'bb.action.CAPTURe' });
}, false); }, false); </script> </body> </html>

 

I then ran this on my device (connected via USB, developer mode enabled) with the command:

 

C:\webworks\invokeRecorder> webworks run

 

And was able to successfully invoke the voice recorder.


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.
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Invoke Voice Recorder

Can you post a snippet the code that you are trying?

 

It should look similar to this:

 

var request = {
            target: "sys.apps.audiorecorder",
            action: "bb.action.CAPTURE"
        };

blackberry.invoke.invoke(
            request,
            function() { console.log('success'); }, function(e) { console.log("error: " + e); }
);

 

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