OpenLayers in Android - android

Has anyone tried before using OpenLayers in Android ? How did that go ? Was it accessed through the browser at a certain address or embedded in a local stand alone android application using WebViews ? , or other approach.
If any references related to this subject come to your mind please add them here.
Thanks

Small update on the topic - currently released version of OL supports mobile devices.

Current version of OpenLayers(2.10) doesn't support mobile browsers. New version(2.11) is very close to release though and you can enable support for mobile devices if you include the development version of OpenLayers from trunk. It definitely works if you access it as usual webpage and should work if it's embedded in WebViews.
You can try it out yourself here: http://openlayers.org/en/latest/examples/
Just type 'mobile' in search field and you'll get couple of example where you can see how mobile navigation, editing, etc. works on Android and iOS.

Yo can try with OpenLayers latest Mobile Version (http://openlayers.org/en/latest/examples/mobile-full-screen.html) for an html project and embed the page in Mobile App with Apache Cordova (http://cordova.apache.org/)

To my knowledge (no such device owned), on Android 3+ devices a page like http://openlayers.org/dev/examples/mobile.html will work straight out-of-the-box when opened in the stock browser. As mentioned, since OL 2.11 mobile device multitouch events are supported, they have also provided a jquery mobile & geolocation demo which works great on android.
For the majority of android 2.x devices, you will need to deliver your own webview container including a polyfill such as WMP if you want spread & pinch zooming to work.
Otherwise you're only left with using the zoom buttons - which is not always preferable given the small size of many touch screens.

Related

CSS and Javascript features available in Cordova/Ionic/PhoneGap apps?

When writing CSS and JS for Cordova apps, how do I figure out which features are available to use? When I go to caniuse.com, am I looking at iOS Safari and Android Browser or Chrome? Is there a table somewhere that will help me map Cordova versions, OS versions, and browser versions?
I've been stung once by the JS await operator not working in an app that I thought would work in iOS 10.1. I'm now not sure how to tell what's the oldest Android version on which that app will work. And I'd like to be able to figure out which features are usable based on an OS decision predetermined by my clients or managers.
This is a very good question and one that cannot be answered with a single sentence. I can share some experience though:
Android vs. IOS
IOS is the most predictable as all Apps have to use the same WebView that comes with the OS. When you set a minimum IOS version (for example 10.0) you can look up supported features for Mobile Safari on caniuse.com.
Android is a completely different story as there is absolutely no way to predict which WebView the user is using. It will usually be some version of Chromium but starting from Android 5 it can be updated independent from the OS via the Play store. If you absolutely must support Android 4 you could create a separate build and using Crosswalk (unmaintained but still working) to get a predictable WebView.
JavaScript / CSS
If you're using Ionic then JS will usually be less of a headache as you develop in TypeScript and transpile to ES5. For CSS on the other hand you will have to resort to the usual browser checks / hacks / fallbacks as we did back in the days when we had to deal with browsers like IE6.

Download attribute not working in Phonegap app

This is not my first hybrid app (I've published apps on both Google Play Store and Apple Store). My target platform is Android. I'm not sure which versions will be supported, I will determine that later if I decide to publish this idea at all.. I'm using Phonegap Build.
I'm having some trouble getting the HTML Download attribute of the A element to work. Here's what I have:
<a download href="http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2014/4/11/1397210130748/Spring-Lamb.-Image-shot-2-011.jpg">Lamb</a>
If I remove the download attribute, the image opens in my phonegap app (Android). With it, nothing happens though. Works fine in at least Chrome, too. Any ideas?
#Robbert,
I answer alot of Cordova/Phonegap questions like alot of volunteers on this forum. As such, you might find this FAQ useful.
Top Mistakes by Developers new to Cordova/Phonegap
From this FAQ, you want to be aware of #5 - Phonegap is not a webserver or a webbrowser. This is common mistake. It is true you can use your webbrowser to test you pages, but don't be fooled into thinking that all webbrowsers are the same. As Paul Irish likes to remind use "Not all webbrowser are equal". His article Webkit for Developers is a good read.
I quote
Different ports can have different focuses. The Mac port’s focus is split between Browser and OS, and introduces Obj-C and C++ bindings to embed the renderer into native applications. Chromium’s focus is purely on the browser. QtWebKit offers its port for applications to use as a runtime or rendering engine within its cross-platform GUI application architecture.
To be clear, Phonegap uses a library called webview (with Android, and similar on other platforms). The current incarnation is based on Chromium's "webkit", but previously it was based on an old version of Android "webview" - which was around for years. However, even with the attribute you are looking for may not be available.
The best was place to start is caniuse.com. A search for download shows that download is mostly supported, but missing is IE, Safari, and Opera. Otherwise, it appears it is available, but only for Android after 4.4. Looking at my notes this appears to coincide with Android starting to use Chromium's webkit, and not the dated webview library — as i stated before.
Possible Solutions
As #jcesarmobile alluded to you can use
cordova-plugin-file-transfer
_OR_
You can try another webview library that might have the attribute you are looking for
- like crosswalk.
At this time, crosswalk only supports Android, but there are also a few beta version you can also try that are in the repository. And, if your target platform is iOS, then use WKWebview instead.
NOTE the standard webview library is already on your mobile device, crosswalk is separate and will add at least 20megabytes to your app.

Using Webrtc in Native App

My questions is :
1 -- Is it possible to have a WebView( Provided by Native framework) instance in my Native App , and extend it to support Webrtc,
if 1 is Yes, then probably following would be the action Item
1 -- Have a webrtc build on Android, 2 -- In Android WebView extend Javascript to couple / bind the Webrtc call,
Please confirm..
What i am trying to do is
1 -- We have webrtc based Voice / Video chat application working fine in Chrome & Mozilla desktop Browser, as both comes with webrtc... , i.e. user need to access www.xyz.com and it will start video / voice sessions,
2 -- same thing on mobile, we would like to go as a native app, i.e. we are trying to make an application, which will have native WebView instance, in which we will access www.xyz.com to have voice / video session
3 -- I tried the way i explained in 2 but it seems, in WebView instance provided by Application framework doesn't have webrtc enabled in it, so i am trying to add it and this is what i am thinking,
-- WebView instance has some mechanism to extend the Javascript , that means
http://dev.w3.org/2011/webrtc/editor/webrtc.html
some of these API i need to add into the WebView, and for their implementation will come if i am able to successfully integrate and build Webrtc over android and iOS Platform
Please comment....
If you want to use webRTC in a Native App, i've built a small android app (https://github.com/pchab/AndroidRTC) that share the back camera to a nodeJS server (https://github.com/pchab/ProjectRTC).
I found that the easiest way to use the libjingle library is with IntelliJ IDEA. I've had a lot of problems with Eclipse and Android Studio.
You're going to have a hard time with the WebView, although it's coming on (newer) Android at least. Nothing on the horizon for iOS.
If you want complete native, you can check out what we've done # FM with IceLink, sounds like it might work for you.
Android WebView does not support WebRTC APIs at this point.
Work is underway on Java an Objective-C bindings, though that may not solve your problem.
With Android L release this should be possible by using just the Android WebView, more below :
http://developer.android.com/about/versions/android-5.0.html#WebView
I know this question is kinda old, but I find crosswalk (https://crosswalk-project.org/) to be a pretty good solution for using WebRTC inside of an Android app. What crosswalk do, is compiling a chromium browser into an Android app and hosting your site inside of this chromium, so you will have support for the latest browser features, like WebRTC.
I'm building a native app with a webview and webrtc video inside.
So generally it is possible to build such application and nowadays chromium (webview) have a official support https://developer.chrome.com/multidevice/webview/overview , but I have faced really a lot of problem during writing that application.
Few problems are:
Support for phones and os version - I have android 5.1.1 (xperia m2) and after a lot of problems webrtc is running. On android 6 (xperia z5 compact) is not working.. On other phones is sometimes working sometimes not...
You can not be sure, how webview will work - today webrtc is working, but tommorow Google can add some security rule, and it will not work- it's a little bit unstable, and as I have seen, some things depend on os compilation. WebView can get update from store independently of os.
PERMISSIONS - there are a lot of stupid problems, based on the fact that is it a browser inside native app, like - you can't expect a permission question from webview, you have to implement it in android webview config, and in some android versions it is working- in others not :-)
Still a lot of problems of 'young product' - example is that nowadays webview has some issue with devices info display (like camera is front or back) so you have to find a workaround for such problem
Bad video quality - currently my problem is a quality of video- nice quality of video on phone, below maximum resources consumed (cpu, network, memory) and video on computer is really poor...
...and many more
So the fact is - yes this is possible, but it's still not good enough to use it without facing a lot of problems which are not so easy to solve.
You can actually go native with html5 features. So if you use Crosswalk as someone mentioned before, but if you are really set against using: Crosswalk/Ionic/Angular/Cordova (which is awesome), you can still use Crosswalk in a native environment to replace inconsistent and feature lacking WebViews with 1 single, full WebRTC compatible WebView based on the Blink Engine.
I remember reading a few guides on how to get Crosswalk going in Android Studio, here's one I quickly searched, but just Google around there's a bunch of them.
https://www.snip2code.com/Snippet/34721/How-to-use-CrossWalk-runtime-within-an-A

A web app using kendoui doesn't run on android tablet

I developed a web application that turns in different browser(opera,firefox,chrome).when i access via tablets except the native browser of android.i tried with different tablets and the same problem.It ignores the composant such as datepicker...I didn't find a tool to debug the site.i tested it with android 2.3
I'm waiting your reply.that's very important to help me.
Thank you
Maybe you get more insights why it is not working if you see the javascript console and its output. This question will tell you how to access it.
Kendo UI Mobile only provides styling for the native browser input, select and textarea elements. This means that you won't get date/time pickers where they are not supported. Default Android browser doesn't support HTML5 input pickers, thus you won't get any. You can work around that by using some kind of validation there or use a third party library as MobiScroll.
Also note that Firefox and Opera are not officially supported.

Phone Gap or native Android wrapper?

I want to develop an application which works both in a regular browser and as an Android app. Both seem suitable but would I be right in saying if I went with Phone Gap, deploying the same html content as a regular, server hosted website is not trivial and would require modification? Also, are multi page applications not desirable in a Phone Gap wrapper?
Are there any alternatives I should consider? I'm surprised someone hasn't already written an Android wrapper with all the hardware access wiring done already. Or have they?
There are few things you should know,
If you are going to publish your app also on iOS, you can't use server hosted website for your app.
All of your basic functionality must stand on your app assets, is one of the iOS guidelines, and its also make-sense for best ui performance (both iOS & Android).
Use server-side wisely, when you want to fetch data which have to be up-to-date.
there are some new mobile browser features which will be available in the future, that allow your website to use the device hardware functions:
Device API on W3C
Good luck dude ;)
You can try with jquery mobile framework:
http://www.jquerymobile.com
It is jquery based framework for developing web apps that works on standard web and on multiple mobile devices (with cordova)

Categories

Resources