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
raj786
Posts: 11
Registered: ‎08-05-2011
My Carrier: Developer

New HTML5 Webworks vs. Native

Hey guys

 

I have been working on a native Java App for the last two months.

 

Today, with the announcement of the HTML5 Webworks with Native capabilities (https://bdsc.webapps.blackberry.com/html5/ ) I am trying to find the differences between than and what's doable with native. Is there is a list that compares the features anywhere, mainly what does Native have that this HTML5 Webworks does not have still.

 

I would of course prefer to go the HTML5 route, but the main reasons why I decided to go Java was 

- Needed the application to run in the background when the phone starts.

- Needed Push notifications while the application is in the background

- Needed to make calls to the GPS on various intervals while app is in the background as well as connect to the server to check a geofence. 

 

Would the new HTML5 Webworks kit be able to support the above native capabilities? Any specific things that it would not support?

 

Thank you in advance for any help :smileyhappy:

 

- Tehsin

 

 

 

 

 

 

Please use plain text.
Developer
bert2002
Posts: 172
Registered: ‎05-01-2010
My Carrier: O2

Re: New HTML5 Webworks vs. Native


- Needed the application to run in the background when the phone starts.

- Needed Push notifications while the application is in the background

- Needed to make calls to the GPS on various intervals while app is in the background as well as connect to the server to check a geofence. 

 


the two first is working, the third I didnt implemented yet but I think it will work too. I had an app that did an http request in the background and that worked.



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Please use plain text.
Contributor
raj786
Posts: 11
Registered: ‎08-05-2011
My Carrier: Developer

Re: New HTML5 Webworks vs. Native

Awesome! I appreciate the reply :smileyhappy:

 

Thank you,

 

Tehsin

Please use plain text.
Contributor
raj786
Posts: 11
Registered: ‎08-05-2011
My Carrier: Developer

Re: New HTML5 Webworks vs. Native

Hey 

 

One more question, what additional capabilities does Java have when it comes to native integration that HTML5 does not? I am trying to better understand why I would still use Java as opposed to the HTML5 WebWorks. 

 

Is there a comparison chart somewhere?

 

 

Please use plain text.
Developer
bert2002
Posts: 172
Registered: ‎05-01-2010
My Carrier: O2

Re: New HTML5 Webworks vs. Native

oh good question I dont know. I think depends on what you want to to, but basically with Java you can do more when you code more :smileyhappy: BUT what I heard from the Devcon yesterday that the JDE will not be supported in BBX so its questionable if its still make sense when you create a new application...



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: New HTML5 Webworks vs. Native

A comparison chart would actually by gigantic trying to show the differences and similarities between what can be done in JavaScript and Java at the language level and then looking at what can be done with HTML and CSS vs painting yourself in Java.

 

It really comes down to whatever specific use case you are looking to do. Can it be done in WebWorks?? Maybe.. Can it be done in Java?? Maybe..  Is one easier than the other for the specific task that you are looking to do?? Maybe :smileyhappy:

 

I always tell people to choose the technology that best fits your background and experience.  Building applications in Java or in Web are two totally different approaches to tackle the same challenges.  Some almost feel that it is like choosing a religion :smileyhappy:

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
raj786
Posts: 11
Registered: ‎08-05-2011
My Carrier: Developer

Re: New HTML5 Webworks vs. Native

Hi Tim

 

Appreciate the reply. Just to clear the question a bit, I am not looking for a comparision on the language level, I realize that would be completely unfeasible, but rather was looking to find out in regards to the native capabilities with the OS. It looks like although the webworks is has great native capabilities now, it still falls short in some key areas. Having said that, I just want to say the capabilities offered so far are indeed awesome. I think we could do a bit more on getting info out on there on what can and cannot be done with this rather than having the developer find out by digging through the API.

 

For example, one key difference I just found out and perhaps you can correct me if I am wrong, but apparently the GeoFence class for example (

net.rim.device.api.location) 

http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/location/Geofence.html

which lets you define geofenced areas and receive notifications when a BlackBerry device user enters or leaves the specified area.

 

It's only available if you are using Java. If you are using HTML5, I don't see that or a similar class available in the stack. And perhaps there is an alternative way of doing that (instead of writing my own class), so am looking into that now, but I wish information like that was easy to find, and once again just a simple list would have helped. 

 

Tim: One more question; if I finish writing this app in Java, I am assuming it would not work on any new phones running the new BBX platform, is this correct? 

 

 

Thanks,

 

Tehsin

Please use plain text.
BlackBerry Development Advisor
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Carrier: Rogers

Re: New HTML5 Webworks vs.. Native

Hi Tehsin,

 

The webworks platform is designed to be an extendable platform. THus when you find some native API (say GeoFence) that hasn't been implemented yet in Javascript, if you have the native knowhow you can port the API yourself. We have a whole community repo dedicated to it here - https://github.com/blackberry/WebWorks-Community-APIs

 

That being said, you can use HTML5 Geolocation watchPosition (https://bdsc.webapps.blackberry.com/html5/apis/navigator.geolocation.html#.watchPosition) to get an event every time the user moves and you can filter them out based on location.  This would be the approach I'd recommend.

 

While I understand its not always the simplest to figure out what the capabilities of the platform are, we've been doing a lot of work on our API docs (https://bdsc.webapps.blackberry.com/html5/api) including adding references for HTML5 APIs to try and make the process easier.

 

Ultimately though, the answer is really what Tim said. In most cases whatever you can do in the one platform you can do in the other, it just may be more difficult.

 




1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
Developer
miamon
Posts: 177
Registered: ‎08-17-2008
My Carrier: Vodafone

Re: New HTML5 Webworks vs.. Native

[ Edited ]

Jeff just a question,

 

Native vs HTML5 at PlayBook, not in Smartphone. 

And Java will no be available in BBX and OS 1.0, 2.0 on PlayBook. 

 

So I am interested to know, if all (an when i say all is all) APIs that sure will be available in Native, will be available in WebWorks. Now we have tons of apis available in Java and not in WebWorks.

 

I understand that JavaExtensions it's not a good solution for some Web developers like me.

 

if the answer is yes: interested to know when and how will be access.

 

Thanks in advance,

 

Josep Maria
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: New HTML5 Webworks vs.. Native

Hi Josep,

 

We won't be bringing up "all" of the Java/Native APIs into WebWorks.  There are all sorts of Java/Native classes that are primitives, used for native UI, persistence and other classes that already have a duplicate way of solving the task in a web fashion.

 

The APIs that we are bringing up are based on use case scenarios that the community has asked for, especially around exposing BlackBerry specific functionality.  The order in which these APIs are exposed are based on the priority that we hear from the community.

 

This is why we will see APIs such as BBM integration be tackled first before things such as being able to change the LED blue.  It is all based on demand.

 

All Native/Java APIs will have to be abstracted into use cases, wrapped in an appropriate API for the web and exposed into the WebWorks layer.  In 99% of the cases, exposing the Java/Native APIs verbatim doesn't really work.  The Native/Java APIs typically all are in the fashion of creating a class that implements a complicated interface which doesn't translate well to JavaScript.

 

As an example, the number one use case for the camera API was to take a picture and get the file path back for the picture that was just taken.  The camera capabilities have hundreds of options, properties and possible sets of functionality that make taking a simple picture a challenging prospect.  We want to abstract all of this to make sure that you can simply take a picture and not deal with the underlying complexities of the Native/Java layer.  It doesn't mean that we won't expose some of the other functionality eventually, but we want to tackle the majority use case first.

 

Of course, wrapping these APIs to be exposed to web developers is not for the faint of heart and much of the work is figuring out the right balance of simplicity and functionality.  For those desiring functionality that is not yet exposed and would rather not try and delve into Java/Native development this can be a tough situation.  As it means you are left to wait for the functionality to be exposed by RIM or someone else.

 

We have been receiving contributions from those who are creating these extensions and giving back into our Community Open Source API repository.  We also encourage those who have created extensions to share them back with the community.

 

So there isn't a date that we can give when "all" of the APIs will be exposed.  What I would encourage you to do is check out the outstanding feature requests for WebWorks for Smartphones and Tablet and if there are APIs that have been requested which you also want to see exposed, please comment on the feature.  If your desired API is not in the list I would also encourage you to add it to the list so that our development team knows that it is important to you.

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.