Works On Mine Works On Mine - 9 months ago 100
Android Question

Android Widget using Cordova

I am planning to bundle together some minimal functionality into an app or a widget for android devices. However on second thought I realized that I have never heard/read someone building a widget with Cordova/Phonegap before. I googled a bit and the answers seem to be suggesting a 'no'. I read the description on the home page for Phonegap and it says that it allows users to build apps basically.

So, could someone please point me in the right direction as to wether its possible to create an android widget in Cordova. And if no, how is an widget conceptually/practically different from an app.

PS: just maybe i am using some incorrect terminology here. What I mean by a widget is this. Its something that sticks on the home screen mostly in a translucent bar.

Answer Source

Widgets are android native constructs that extend a view on the application screen.

A cordova/phonegap app is an app with a webview backing. Note: webview not android native view.

Until someone finds a way to construct a native widget that embeds a webview, then what you have been told so far is correct... i.e. "no".

Edit: It "is" conceivable you could have a widget associated with your cordova project, but then you would be writing android native code alongside cordova.... most people would see this as defeating the point of using cordova, unless you are ONLY targeting android. In which case I have to ask the question:

"Are you using cordova as an easier way to start app coding on android or are you trying to leverage the convenience of cordova to share a code base across multiple platforms?"

If it's the former, then just write a native app. If it's the latter, then cordova isn't going to (easily) give you widgets, nor cross platform widgets