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
Contributor
mirtheil
Posts: 15
Registered: ‎07-23-2012
My Device: BB10 / Playbook

invokeEmailComposer not working in gold SDK

I'm trying to get the blackberry.invoke.card.invokeEmailComposer working in a Webworks application and am having no luck.  Other cards work, like blackberry.invoke.card.invokeCalendarComposer, but invokeEmailComposer isn't.   I've tried on both the simulator and a Dev Alpha device with the same results. Nothing is happening when I call the .invokeEmailComposer.  Does anyone have any suggestions?

Here is a small sample showing what I'm doing:

<html>
	<head>
		<title>Invoke API</title>

		<link rel="stylesheet" href="BlackBerry-JQM-all.min.css" />
		<script src="BlackBerry-JQM-all.min.js"></script>
		<script src="local:///chrome/webworks.js" type="text/javascript"></script>
        <script>
		
            function ready() {

                blackberry.event.addEventListener("invoked", function (onInvokedInfo) {
                        var obj = document.getElementById('image');
                        obj.src=onInvokedInfo.uri;
                    });
                findShareTargets();

            }
            window.addEventListener("load", function(e) {
                document.addEventListener("webworksready", ready);
            }, false);



            function onInvokeSuccess() {
                console.log("Invocation successful!");
            }

            function onInvokeError(error) {
                console.log("Invocation failed, error: " + error);
            }

                blackberry.event.addEventListener('onChildCardClosed', function (info) {
                    console.log("Card was closed");
                });
            }

            function invokeCalendarComposer() {
                blackberry.invoke.card.invokeCalendarComposer();
            }
	        
            function invokeEmailComposer() {
                try
                {
					alert("Before Compose");
				blackberry.invoke.card.invokeEmailComposer();	
				alert("After Compose");
                }
                catch (e)
                {
					alert(e);
                }
            }
            function invokeEmailComposerOption() {
               blackberry.invoke.card.invokeEmailComposer({
               subject: "Email subject",
               body: "Email body",
               to: ["a@a.ca", "b@b.com"],
               cc: ["c@c.ca, d@d.com"],
               }, function (done) {
                   console.log(done);
               }, function (cancel) {
                   console.log(cancel)
               }, function (invokeError) {
                   console.log(invokeError);
               });
            }
        </script>
	</head>
	<body>
		<div data-role="page">
			<div data-role="header" data-theme="c" data-position="fixed">
				<h1>Invoke Demo</h1>
			</div>
			<div data-role="content">
				<ul data-role="listview">
					<li><a href="#" onclick="invokeCalendarComposer()">Invoke Calendar Composer</a></li>
					<li><a href="#" onclick="invokeEmailComposer()">Invoke Email Composer</a></li>
					<li><a href="#" onclick="invokeEmailComposerOption()">Invoke Email Composer Options</a></li>
				</ul>
			</div>
		</div>
    </body>
</html>

 And here's my config.xml:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
		version="1.2.0"
        id="InvokeCard">
    <name>InvokeCard</name>
    <content src="index.html"/>
     <author>self</author>
    <description>This app tests the invoke API.</description>
	<feature id="blackberry.identity" required="true" version="1.0.0.0"/>
    <feature id="blackberry.invoke" required="true" version="1.0.0.0"/>
    <feature id="blackberry.invoke.card" required="true" version="1.0.0.0"/>
    <feature id="blackberry.invoked" required="true" version="1.0.0.0"/>
       <feature id="blackberry.app.orientation">
        <param name="mode" value="portrait"/>
    </feature>
    <access uri="*"/>
    <license href="http://www.apache.org/licenses/LICENSE-2.0">My License</license>

	<rim:permissions>
		<rim:permit>access_shared</rim:permit>
		<rim:permit>access_pimdomain_messages</rim:permit>
	</rim:permissions>
</widget>

 

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

Re: invokeEmailComposer not working in gold SDK

I think you have some bad JavaScript. Tried running it through jslint and got the following error:

 

Expected '(end)' and instead saw '}'.

 

Looking at the source, it seems like there's an additional } character after this block of code:

 

 blackberry.event.addEventListener('onChildCardClosed', function (info) {
                    console.log("Card was closed");
                });

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Contributor
mirtheil
Posts: 15
Registered: ‎07-23-2012
My Device: BB10 / Playbook

Re: invokeEmailComposer not working in gold SDK

Thanks. I've fixed my code.  I had copied it from a bigger project and must've missed it.   I'm still seeing the same behavior though.  The CalendarComposer pops up correctly but the EmailComposer isn't.

Using the Remote Web Inspector, I'm now seeing an error when calling the invokeEmailComposer():

 

 

TypeError: 'undefined' is not a function (evaluating 'invokeCallback()')

 

Is there any configuration of the simulator or Alpha device that needs to be done before the EmailComposer works?  

Contributor
kovy
Posts: 26
Registered: ‎08-25-2011
My Device: Z10

Re: invokeEmailComposer not working in gold SDK

I get the same error. Could it be because no application for email is not available yet on the devalpha B? How can he relied on email software if it is not present?

Contributor
mirtheil
Posts: 15
Registered: ‎07-23-2012
My Device: BB10 / Playbook

Re: invokeEmailComposer not working in gold SDK

@kovy,

That was the conclusion I reached.  I've submitted my application with code based on the examples in the documentation and it was approved. When BB10 is released and I get a fully functional device, I'll double check it and update my application as needed. 

I think there should have been some way to test it but I can understand limiting the features on the Dev Alpha device. 

Contributor
kovy
Posts: 26
Registered: ‎08-25-2011
My Device: Z10

Re: invokeEmailComposer not working in gold SDK

Is that your application has been approved to 10k developer challenge? I am worried about not meet the criteria, if they are testing with devalpha b.

 

Thanks

Contributor
mirtheil
Posts: 15
Registered: ‎07-23-2012
My Device: BB10 / Playbook

Re: invokeEmailComposer not working in gold SDK

I have only submitted it for the 10K challenge.  When I get a response, I'll post here. 

Contributor
awjenning
Posts: 38
Registered: ‎08-06-2011
My Device: PlayBook

Re: invokeEmailComposer not working in gold SDK

Is there any news on this??  invokeEmailComposer is not working on the BB10 simulator or the Alpha Dev device. Can we get a current version of the simulator with the components necessary for this to work?

Contributor
mirtheil
Posts: 15
Registered: ‎07-23-2012
My Device: BB10 / Playbook

Re: invokeEmailComposer not working in gold SDK

I have already sent my Dev Alpha back and wasn't able to try my app with a final version. I have tried the latest simulator and it did invoke the Email Composer using my code as posted above. My app, however, was rejected for the Built for Blackberry program with a vague reason. I have asked for clarification on the rejection but have not heard back.
Contributor
awjenning
Posts: 38
Registered: ‎08-06-2011
My Device: PlayBook

Re: invokeEmailComposer not working in gold SDK

Why did you send it back? I must have missed something