12-15-2012 06:21 PM
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('onChildCardClos ed', 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>
12-17-2012 02:11 PM
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('onChildCardClos ed', function (info) {
console.log("Card was closed");
});
12-19-2012 04:00 PM
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?
01-10-2013 10:04 AM
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?
01-10-2013 10:11 AM
@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.
01-10-2013 10:21 AM
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
01-10-2013 10:43 AM
I have only submitted it for the 10K challenge. When I get a response, I'll post here.
02-08-2013 02:42 PM
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?
02-08-2013 02:49 PM
02-08-2013 04:28 PM
Why did you send it back? I must have missed something