Execute Android phonegap app with opera/Chrome mobile - android

I have developed an android webapp with Phonegap (Cordova 2.7.0). The app needs to receive some prices pushed by a server through the use of a third party JS API (Diffusion).
The app works well on standard desktop browsers, where websockets are available, however on the Android emulator does not seem to work due to this latter's lack of support for websockets.
I thus thought to use a different mobile browser, such as Opera or Chrome, however I now have the problem of ensuring Android uses this new browser, when executing my webapp, rather then the standard one.
Does anyone know how to do this?
Thanks.

PhoneGap for Android uses WebView, not a browser.
The simplest solution is to use a Web sockets plugin for PhoneGap, or to write your own such plugin if you cannot find an existing one that you like.
It is theoretically possible to rewrite PhoneGap to use the Android version of Chromium, but this will be a massive undertaking.

Related

Can i build an android and ios app with jquery mobile

Please, am a web developer. I just built a web app for a school to manage their results and fees.
Now, i intend to build an app on android and ios so its 'easier' for both staff and students to get notifications and interact better.
Is JQuery mobile the asnwer?
Thanks for your reply
jQuery Mobile doesn't create an application for Android nor for iOS, it only makes websites look better on said platforms.
To create a real, native, application for Android you should use Android Studio. To do the same for iOS you need XCode and MAC OS X.
But, if you prefer to write websites, Apache Cordova does what you need. Allows you to create apps for any platform using your usual HTML, CSS and Javascript.
I'll drop the link here so you can check it out.
https://cordova.apache.org/
Another approach is creating a basic Android and iOS app that simply opens a web page (your website), but it is most of the time lacking in performance. If this last approach interests you, just look up "WebView" for Android, "UIWebView" for iOS (Obviously you'll need Android Studio and XCode)
EDIT
This is an old answer, now a ton of different technologies exist to build multiplatform applications, without even losing out on performance (for example, see react-native)
If you have already built the app using JQuery mobile and want to make it into an app I recommend looking at Cordova (PhoneGap) https://cordova.apache.org/
For notifications etc I found https://www.pushwoosh.com/ to have the best integration

Polymer 1.x: Going from web to mobile

I have a Polymer web app. I need to deploy it to mobile Android and iOS devices.
I have my vulcanized dist directory after running gulp.
I have a hosted URL.
Question
Now what do I do? What steps do I need to take? (And where is the documentation?)
I tried using PhoneGap Build but encountered compatibility issues.
This SO answer pretty well documents that PhoneGap Build does not support Polymer at this time.
There is article written by Eric Bidelman on
Using Polymer in a WebView. How to setup Polymer in an Android WebView app.
Here is the link.
https://www.polymer-project.org/0.5/articles/webview.html
We have built an in-house mobile applications with Polymer and Cordova.
It generally works with android 4.4 onwards since WebView for android 4.4 onwards is based on the chromium project.
As for iOS 8.1 onwards, we thus far have not encountered any issue. Note that Polymer will not work on iOS7 & below.
Should you need more modern web API, you can include Crosswalk for Cordova.
Hope that helps.
That's me. I look further into that.
I talked to my friends in that group, they know of no such projects.
However, they did express that it was possible, IF the web library supported ECMA5 (the Javascript standard). I looked into it and found that potentially there is support
However, I do not have any evidence that this will or will not work. The best I can say is to try the following.
Build the library on a local machine (your PC) to make sure you understand it.
Build a Cordova/Phonegap Application with the new Crosswalk Webview Library.
Find a very simple Webcomponent you can test with. Something equivalent to "hello world".
Test
Please let me know how this works out.
Best of Luck,
Jesse
Can't say I've found good documentation on this apart from this tutorial on using Apache Cordova with Polymer (though this is Polymer 0.5):
https://blog.nraboy.com/2014/07/use-polymer-apache-cordova/
I've been successful (so far) in using Cordova to build my polymer app and it runs successfully in a browser and on Android (haven't tried iOS yet).
I put all of my html and css in the 'www' directory of my Cordova project and have had no issues with build.
For android the simplest approach would be to create a webView and load your url to it. This kills most of the compatibility issues.
As rendering engine of chrome and web-view are both webkit based, most of thing that runs in chrome,will run in webview as well.
For details
https://developer.android.com/reference/android/webkit/WebView.html
how to display progress while loading a url to webview in android?
Similar thing can be done at IOS as well..
iOS: WebView Loading a url
It will definitely going to increase your workload a bit, however it does give you presence in both app stores.

Sockets in WebView Android

Im having an application written in .NET (i guess) and is quite responsive. The idea is to wrap the app as an android app. The android app is going to have many more functionalities and this webview is just one of them.
My question is the current web app is using some sockets to push data to the page. So the content changes without refreshing the page. Will that functionality be intact in android webview too?
I should have tried this by building the app, but my bad they currently do not have any data and aren't pushing either.
I ran into the same issue. From what I can tell, Android browser (aka WebView) does not support WebSockets : http://mobilehtml5.org/
Although there is a workaround using Socket.IO which you can try out: http://chpeck.tumblr.com/post/37273036645/socket-io-with-android-webview
Gist: https://gist.github.com/secobarbital/4220309
Another easier alternative is to use Pusher on your website, which will automatically fall-back to Flash if it detects a browser that does not support WebSockets.
EDIT
In Android 4.4+ original WebKit-based WebView has been replaced by Chromium which supports WebSockets among other goodies. More info: http://www.mobilexweb.com/blog/android-4-4-kitkat-browser-chrome-webview

Is PhoneGap the right choice for me?

I am new to PhoneGap, and I have several questions:
I need a way to develop an application that will have iOS, Android, and other platform compatibility. In other words, I want to write 1 app and get compatibility versions for different platforms.
By reading the "Get Started" guide linked by the PhoneGap website, I found there are different procedures for different platforms. So to have compatibility versions across platforms, do I have to go one-by-one and change all of them if I make a modification to my app?
Also, what exactly is PhoneGap Build? It seems like I can avoid all that hassle mentioned previously and toss my app into the PhoneGap Build? Do I really not have to do anything besides writing the app? What if I need to make changes?
And finally, I've read that PhoneGap works with HTML, CSS, and Javascript, but not PHP. What if my app needs to contact a server? Can PhoneGap handle that?
Thank you for bearing with all these questions!
PhoneGap achieves platform compatibility by embedding a webview within your application. Therefore you can apply your knowledge in HTML, CSS, JavaScript and it additionally provides ways to interact with native features (e.g. camera, gps, ...).
With PhoneGap you write one general web app, tweak parts for the specific platform (sometimes you do not have to this at all) and build it for that platform. The latter can be handled with PhoneGap Build service: It takes your webapp and bundles it for the mobile operating systems out there (Embeds it within a Java app on Android, an Objective-C app on iOs)
PhoneGap is able to communicate with a server hosting a PHP script just as every other web application. Trying to dynamically load resources from remote sites can be quite a hassle but this is another question.
traumalles is correct. All your HTML/Javascript/CSS is running from within a webview on the device. Your code is, therefore, all "client-side." You can communicate with a server just like with any other page. When they say PhoneGap isn't compatible with PHP, they mean only that PhoneGap can't execute PHP code like it's a server, because it's not. It's just loading your webapp in, basically, a browser.
One other important question is what exactly do you mean with "other platforms" phonegap does provide many functionality for nearly every platform but the different webbrowser of the mobile devices have their problems and limitations.
For example are there many problems if you want to provide your application on a WindowsPhone Device because the Webbrowser has a few limitations which will cause your app to not look and behave like a native app.
Just look a bit through the phonegap API you will see that some functions are just available for IOS or for Android and there are a few only Blackberry methods and so on.
So you really have to be careful when a framework tells you it will work on all devices.
So i really don't have a problem with phonegap i worked with it very great but there will be limitations you have to deal with.
If you primarily want to develop for IOS and Android you can really achieve great native like results !

Offline Web Application HTML5 on Android

I want to develop a HTML5 Web App.
I read that in HTML5, you can use the new feature "Offline Web Applications"
With the *.manifest file
I read an article from november 2010, that this feature only works on the iOS platform.
Does it work on Android now?
Yes. It works on Android as well as iOS and most desktop browsers. You don't need PhoneGap unless you want to access native features or deploy to the App store.
UPDATE:
Check out this chapter from Jonathan Stark's book: Building Android Apps with HTML, CSS, and JavaScript.
In general, http://mobilehtml5.org/ provides nice mobile compatibility tables to answer this and other similar questions.
Yes it can. Here's an example for an offline game:
http://www.davidgranado.com/2010/11/make-a-set-mobile/
The one thing that sucks is that iOS generates a nice icon automatically. However, android doesn't. Also, I noticed that on random versions of android, it will display an error popup about the fact that it can't connect to the internet, but still runs fine after that.

Categories

Resources