blackberry / WebWorks-TabletOS

BlackBerry WebWorks for Tablet OS is a platform for building deeply integrated web applications for the BlackBerry PlayBook
http://us.blackberry.com/developers/tablet/webworks.jsp
Apache License 2.0
70 stars 14 forks source link

Cannot launch mail client using mailto: in Tablet OS 2.0 #53

Open astanley opened 12 years ago

astanley commented 12 years ago

The browser supports the mailto: scheme, but WebWorks applications running on Tablet OS 2.0 do not.

kwallis commented 12 years ago

Is this widely used in WebWorks apps?

astanley commented 12 years ago

Yeah I think so - I'll try to add facts here to this thread.

Should have added a link!

Discussion about this in the forums: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/PlayBook-mailto-lt-recipient-gt-fails/td-p/1591465

Have also received a request via BBM from Kathryn (Larhs).

I'm seeing more and more interest in this, especially now that Tablet OS 2.0 has launched and there is a native email client.

kwallis commented 12 years ago

What was the behavior on 1.0? Launch bridge mail if it exists?

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: Adam Stanley <reply+i-3526164-2aa7fa63ec51d611bc23d2cc8dd541325a2a5eb3-498318@reply.gith ub.com> Date: Tue, 6 Mar 2012 10:44:45 -0800 To: Ken Wallis kwallis@rim.com Subject: Re: [WebWorks-TabletOS] Cannot launch mail client using mailto: in Tablet OS 2.0 (#53)

Yeah I think so - I'll try to add facts here to this thread.

Should have added a link!

Discussion about this in the forums: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/PlayBo ok-mailto-lt-recipient-gt-fails/td-p/1591465

Have also received a request via BBM from Kathryn (Larhs).

I'm seeing more and more interest in this, especially now that Tablet OS 2.0 has launched and there is a native email client.


Reply to this email directly or view it on GitHub: https://github.com/blackberry/WebWorks-TabletOS/issues/53#issuecomment-435 0409


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

astanley commented 12 years ago

I suspect the same - did not launch the mail client. Honestly can't remember!

-----Original Message----- From: Ken Wallis [mailto:reply@reply.github.com] Sent: Tuesday, March 06, 2012 1:55 PM To: Adam Stanley Subject: Re: [WebWorks-TabletOS] Cannot launch mail client using mailto: in Tablet OS 2.0 (#53)

What was the behavior on 1.0? Launch bridge mail if it exists?

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: Adam Stanley <reply+i-3526164-2aa7fa63ec51d611bc23d2cc8dd541325a2a5eb3-498318@reply.gith ub.com> Date: Tue, 6 Mar 2012 10:44:45 -0800 To: Ken Wallis kwallis@rim.com Subject: Re: [WebWorks-TabletOS] Cannot launch mail client using mailto: in Tablet OS 2.0 (#53)

Yeah I think so - I'll try to add facts here to this thread.

Should have added a link!

Discussion about this in the forums: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/PlayBo ok-mailto-lt-recipient-gt-fails/td-p/1591465

Have also received a request via BBM from Kathryn (Larhs).

I'm seeing more and more interest in this, especially now that Tablet OS 2.0 has launched and there is a native email client.


Reply to this email directly or view it on GitHub: https://github.com/blackberry/WebWorks-TabletOS/issues/53#issuecomment-435 0409


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.


Reply to this email directly or view it on GitHub: https://github.com/blackberry/WebWorks-TabletOS/issues/53#issuecomment-4350588


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

muerl commented 12 years ago

As an ISV dev I vote for this issue.

Actually I would vote for any PIM integration in webwork on tablet ASAP.

astanley commented 12 years ago

More demand: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-programatically-send-email-using-Playbook-2-0/td-p/1612515

Bod1985 commented 12 years ago

This is definitely needed by me!

muerl commented 12 years ago

astanley are there PIM APIs for other development platforms? IE Native or Flash?

astanley commented 12 years ago

No there is currently not. Its on the product management roadmap for future platforms. However this capability cannot currently be achieved through a WebWorks extension.

muerl commented 12 years ago

Is there a JIRA issue I can go vote for ;)

lcocea commented 12 years ago

It is surprising that the "mailto" feature is still missing in WebWorks for PlayBook OS 2.0. The sooner this bug is fixed, the better. It would be great if it allowed the WebWorks app to programmatically attach a document to an email message and send it using the native email app.

sdragomir commented 12 years ago

Same problem here: mailto: works in browser, but not in the packaged webworks app (instead of launching native email application a javascript alert is displayed, with the contents of the mailto:, plus "is not allowed" at the end. I tried specifying in the config.xml file, to no avail. Please advise.

lcocea commented 12 years ago

After some API digging I figured out a simple way to send an email from a WebWorks app using the native email client. But then I wonder why there is no response from the dev team on this issue.

muerl commented 12 years ago

Would you share with the posterity please?

lcocea commented 12 years ago

Well, in case I am missing something then maybe someone can improve this code. Here goes:

var remote = new blackberry.transport.RemoteFunctionCall("blackberry/invoke/invoke"); remote.addParam("appType", "mailto:?Subject=SubjectStr&body=" + encodeURIComponent(BodyStr)); remote.makeAsyncCall();

mailto: can be followed by an email address. String SubjectStr must not contain space characters, use %20 instead. Or use encodeURIComponent() like I did for BodyStr.

muerl commented 12 years ago

Interesting. Looking at the code I understand why this works, though I am surprised that its not an understood thing if it does work that way.

This implies that

 net.flash.navigateToURL.navigateToURL(
    new URLRequest("mailto:?Subject=SubjectStr&body=" + encodeURIComponent(BodyStr)));

will work the way described as well, which means there is a hidden backdoor AS api as well.

GOOD find!

lcocea commented 12 years ago

Thanks.

muerl commented 12 years ago

After thinking about this a bit this means that there must be some addressing inside Air to other applications which is not well documented.

I am curious why this didn't seem to work for me from my JSConsole App when I tried blackberry.invoke.invoke('mailto:haagmm@gmail.com')

lewellyn commented 12 years ago

Just popping in... I don't really use WebWorks, but are you saying that it doesn't support the standard PIM APIs, including the messages:// URI scheme?

https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_ref/topic/navigator_invoke.html

Note that the PIM API doesn't currently allow file attachments, though. See JIRA issue TABLET-550 for the bug regarding that. :/ https://www.blackberry.com/jira/browse/TABLET-550

muerl commented 12 years ago

lewellyn rock on. It seems Adam is totally wrong, which is good because these features rock.

Now time to work on some JS magic so the handheld APIs work.

sdragomir commented 12 years ago

@lewellyn I know you said you don't use WebWorks, but do you happen to know how would I call navigator_invoke() from an htm page (WebWorks application)? Anyone?

muerl commented 12 years ago

@sdragomir I believe that what we saw @lcocea showing off means that the blackberry/invoke/invoke api hook which calls net.flash.navigateToURL.navigateToURL seems to be implemented in AIR by calling navigator_invoke(). Hence anything you pass into the invoke API winds up resolving to the linked API page.

sdragomir commented 12 years ago

@muerl that's great, but I could not find anywhere information about how to actually call that from htm. Assuming the code @lcocea shared is javascript, what is 'blackberry' in the context of the following line: var remote = new blackberry.transport.RemoteFunctionCall("blackberry/invoke/invoke");

Is that defined in a javascript library that has to be specified as a feature in my application's config.xml? What feature?

muerl commented 12 years ago

You need to add blackberry.invoke to your config.xml.

<feature id="blackberry.invoke"/>
sdragomir commented 12 years ago

That worked! Thank you!

fgoyti commented 12 years ago

Thank you @lcocea ! Very helpful. I'm wondering where was blackberry.transport.RemoteFunctionCall documented?? I can't find anything on that or how it works

muerl commented 12 years ago

So I am on mobile so I can't link but what he is invoking is the rest api. I know there wad documentation around 2.0.

Its a specialized version of blackberry.invoke I think you can directly invoke it that way, by pretending its a "Browser Url" and "invoking" it.

I am hoping we can push out some extensions at jam next week, to make this more clear.

If you are there look me up ;) ------Original Message------ From: fgoyti To: Muerl Subject: Re: [WebWorks-TabletOS] Cannot launch mail client using mailto: in Tablet OS 2.0 (#53) Sent: Apr 25, 2012 10:00 PM

Thank you @lcocea ! Very helpful. I'm wondering where was blackberry.transport.RemoteFunctionCall documented?? I can't find anything on that or how it works


Reply to this email directly or view it on GitHub: https://github.com/blackberry/WebWorks-TabletOS/issues/53#issuecomment-5347969

Sent From Device.

sdragomir commented 12 years ago

There seems to be a message length limit of 1000 (or so) bytes? I'm getting an error 7 on the PlayBook and I was able to determine it has to do with the message length... If that's the case, is it like that by design? Can the limit be increased?

lcocea commented 12 years ago

Did you try to catch the exception and see what the message reads?

sdragomir commented 12 years ago

@lcocea I don't know how to read the error from the RemoteFunctionCall... I cannot find the documentation for it. Could you please share if you know how that's done?

Thanks!

lcocea commented 12 years ago

You could try this:

try { // your code here } catch (e) { alert(e.message); }

It probably won't work for the async call part but it may be informative if the exception occurs before that statement.

muerl commented 12 years ago

The best bet is it to attach a Flash Debugger to it and see what gets spit out there. (check out my soon to be accepted KB article or this document : https://docs.google.com/document/d/1FNEsp7JtwMgmxCZK56cHoJjdvlQUU3IUZXp6NsE-5TM/edit

Its likely flash will show SOMETHING in the log, and if not you can add a trace(r) to a try{}catch{} in invoke.as on line 58.

On Mon, Apr 30, 2012 at 3:06 PM, Laurent Cocea reply@reply.github.com wrote:

You could try this:

try {    // your code here } catch (e) {    alert(e); }

It probably won't work for the async call part but it may be informative if the exception occurs before that.


Reply to this email directly or view it on GitHub: https://github.com/blackberry/WebWorks-TabletOS/issues/53#issuecomment-5425059

lcocea commented 12 years ago

The exception seems to be raised at the last statement, remote.makeAsyncCall(). I am just speculating, I am off "my reservation" here, so I could be wrong -- I think the argument string for function makeAsyncCall() is too long if length(SubjectStr + BodyStr) is greater than ~1K. Statement alert(e.message) also doesn't run: my PlayBook says "Can't start Messages due to an Error 7". Error 7 description on Unix is something like "arg(s) list too long". We need the API to support email attachments for larger email messages.

sdragomir commented 12 years ago

Thank you for the info. I'll shorten the email message for now and will change it back once the API will have support for attachments. By the way, I still cannot find the documentation for RemoteFunctionCall... I don't know what I would have done without the help from this forum. The online documentation is inadequate, when it's not missing completely, to say the least.

lcocea commented 12 years ago

I agree. But this is common for open source projects. This is one reason why I plan to do most of my BB software development in NDK/Cascades after I publish my next WebWorks app.

asiayeah commented 11 years ago

Is this issue fixed with PlayBook 2.1.0.560? Thanks.

joeljesudoss commented 11 years ago

Hi

I want to send an email with attachment in Playbook using webworks(my existing app is in webworks) Is there any way to achieve this?

The workaround suggested are with character length limitations and also doesnt support attachments.

This thread in github and the thread

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-send-Email-in-Playbook-using-web-works/td-p/1475779

have been going for more than 2 years, please give a solution, any method is fine, it should be supported by webworks in Playbook thats all.

Please help

Thanks -Joel

joeljesudoss commented 11 years ago

SOLVED :D but other problems :(

There is a workaround to invoking mail attachment in playbook,

Use phonegaps webintent.js plugin and webintent.java

And create an apk by building with android sdk

finally convert the apk to bar using hatax apk2bar

now run the bar in playbook and voila, it invokes mail client with attachment :)

I checked on playbook OS 2

But there are still issues with permissions on ajax calls, I am gettin Network error on ajax call for POST on playbook, whilst the ajax is workin fine in android

I have posted the issue here http://supportforums.blackberry.com/t5/Android-Runtime-Development/XMLHttpRequest-Exception-101-APK-to-BAR-file-Conversion/td-p/2166063

pls help

Thanks Regards Joel

joeljesudoss commented 11 years ago

Hi is there a way to get the source code of hatax apk2bar. I tried googling but couldnt find the source code, there is only apk2bar.jar, Is there anyway to contact the developer of apk2bar.jar? If I can get hold of the API they are using to invoke the mail client with attachment, then i could probably use it directly in my webworks and generate a bar instead of building an apk and converting to bar.

pls help

Regards Joel