We will develop a hybrid app, using localstorage as http cache , and it will shared with multiple webview.
so are there any known localstorage compatibility issues ?
android 2.1 ~ 4.x (most for 2.3 ~ 4.x)
First of all I don't think that the local storage could be a suitable solution for caching, because it's funcionality only includes the possibility to save/retrieve/delete key/value pairs, but I don't know exactly what your purposes are.
About the compatibility I would say that the local storage of the android's WebView does not function very well, because it is not persistent across the different tabs/windows, so actually it becomes useless in my opinion. If you want to share the same data in multiple webviews the only way is to use a java database and a javascript interface. There is a implementation on github, which should be suitable for that.
Related
I need to develop a portable application mainly for Windows 8.1 and iPad, but could be expanded for Android, WP and iOS later.
The application consists of calling web services to display data in grids and it contains CRUD operation, and it may save some local data for offline mode then synchronizes later when connectivity is up.
I'm torn between too many solutions, I need your advise for better solution.
1- Solution 1: Go Native for each OS (VS for Windows 8.1 [RT and pro] and xCode for iPad): this solution requires code duplication, logic and UI.
2- HTML5 with WebView app: I think this is a weak solution especially that we have local storage, checking for connectivity and calling ws ...
3- Using Xamarin: I think Xamarin does not support WinRT or Windows 8.1 to share logic code between iPad and Windows 8.1
4- Using Xamarin.Forms: Building the UI is tough and also it does not support Windows 8.1.
From your perspective, what is the best solution? please advices if you have any other proof of concept.
Many Thanks.
Most of the html/hibrid frameworks like Cordova (cordova.apache.org), Ionic (http://ionicframework.com/), etc, uses a native WebView on Android. Until Kitkat the performance of WebView is not production-ready and if you've a list with a lot of elements, the scroll experience is really bad.
If you want to do a simple proof of concept, prototype or whatever, I think that html frameworks are a good alternative. But if you are going to put your bussiness on top of one of this framworks, I would not recommend.
There is an alternative to embed a Chrome using Cordova & crosswalk (https://crosswalk-project.org/documentation/cordova.html) but you will end with an APK ~40Mb for a simple hello world.
Just my 2 cents. I don't see a point in using libraries that are unsupported across the platforms you plan to release and support on. Personally, I'd code natively for each platform. While this takes a lot of work, if you have to ask for direction on which path you want to take your application, then this type of project sounds more like a "you reap what you sow" application. Also, you'll be able to directly support each problem without having to wait for patches, but there are 2 sides to that coin as well. Your opportunity cost is missing future features the library will provide, if it's worth it to you.
If you aim at quality, going native is the only way... You can reduce the amount of work like Google is doing: writing the business logic and unit tests in Java, then converting it to ObjC with J2ObjC and to Javascript with GWT.
In your case, being that Java is a dumbed-down version of C#, you can easily find tools to convert to the latter, finding yourself with native business logic for every platform! That should account for 50%-70% of the codebase...
I think going with HTML5 with webapp view is better option.
Using Cordova (Phonegap) most of the native features are easily achievable in HTML webapp.
PhoneGap Platform Guide
Alot of other plugins are available for the advances features like BLE, NFC.
Calling webservice is really not an issue in HTML5.
Simple ajax is enough, however now a days many advanced frameworks are available which makes your work easy. One of the best among them is Angular JS(maintained by Google ).
Angular JS
For database you can access native database of the target OS or SQLite db of the mobile device.
You can check this link
Storage options
So developing a webapp can be a more efficient solution in your case. It can be best way for you as per my view point. However, you can do some R & D and can find the appropriate for you.
I have a very simple HTML5 app written with trigger.io that fails running under Android 4.4 with errors stating that local content cannot be accessed. Example:
E/AndroidProtocolHandler( 2236): Unable to open content URL: content:////io.trigger.forge9aee7db8338b11e4b77d1231392b77b0/src/images/connect4.jpg
The same code works find under Android 4.3. This applies to all local content including images, CSS and JavaScript. All resources are referenced with relative paths such as "images/image.jpg".
My best guess is that there is an access policy change in newer versions of Android OS but I cannot figure out the details. I have made sure that nowhere in the code attempts to access external resources.
Antoine van Gelder was incredibly helpful on this. His diagnosis was absolutely correct that jQuery Mobile is rewriting the URLs for resources which causes newer versions of Android's Chrome Webview to fail when accessing resources. The generated URLs contain quadruple slashes after the protocol like this:
content:////io.trigger.forge9aee7db8338b11e4b77d1231392b77b0/src/resource.png
The extra slashes cause Webview to fail. Possibly some excessive checking for correctness or a security implication?
Antoine's suggestions of using older versions of jQuery Mobile or building a custom jQuery Mobile without Base Tag will probably work in some circumstances though neither was quite sufficient in my case. Particularly, removing Base Tag also removes some other functionality I needed.
An alternative approach is to make a minor hack to jQuery Mobile. For version 1.4.3 I did the following:
Edited an un-minified version of jQuery Mobile's javascript
Modified the getLocation function:
Save the return value to a temporary variable
Modify the temporary variable by removing quadruple slashes.
I used something very specific and restricted to the "content" protocol: "retVal = retVal.replace("content:////","content://");"
Return the fixed temporary variable
It looks like, starting with v1.3, jQuery Mobile are rewriting the URL's in your document which breaks the Chrome Webview's access to files in the app sandbox.
You could try filing a bug report with the jQuery Mobile devs but to sort this out in the short term your best options are probably one of:
1) Fall back to jQuery Mobile 1.2.1
2) Build a custom version of jQuery Mobile which excludes some navigation features. (Go to download builder (http://jquerymobile.com/download-builder/), scroll down to "Navigation" and de-select the "Base Tag" module)
This should be fixed in JqueryMobile 1.4.4.
I am .NET developer and currently working with WPF and ASP.NET MVC 4. The next project I should start will be a web application with good chance to later create clients for desktop/mobile/tablets. In other words, this application could be used from the web browser but also from native applications on Android, iOS, WinPhone8 and Windows Desktop (WPF). I have very limited experience with iOS development and none with Android dev.
One of the features I plan to have in this product is ability for users to select a language on which they want to use GUI, be it in web browser or any other client. Thus I need to create localization solution that would work with all platforms I plan to support. Since I am starting this project with first creating the web app in ASP.NET MVC I am not interested in using Microsoft's default support for localization via resources files (.resx) since that wouldn't be portable.
What are different options out there for creating multi-language support in apps deployed for various platforms? The first idea is to use XML files but I am also interested in exploring other possible solutions that might already exist out there. Any ideas on how to approach this problem are welcome.
First of all I'm not sure if your question should be addressed to the Android and iOs developers (using the iOs and Android tags) because if the client loads content provided by the server then the most common way to do this localization (i encountered very often) is to provide different URL's for different languages, probably with a parameter in the url, something like wwww.yourserver.com/en_us/otherstuffhere where en_us should be the country code and in this way the client can change the URL that will use for the following requests.
Of course it's rely hard to localize all the app using a server content, especially UI components such as button titles, placeholders etc. for these there are proper ways to localize them using iOS and Android OS features for localization.
P.S I have no idea how Windows phone OS works.
As far as I know, there is nothing really out there that would do what you want.
Most systems work well with JSON.
What you could do, is use any of the .resx to JSON solutions that are out there and just store all your localization strings in resx and then automatically convert them to JSON for other platforms.
Forget about one solution, just use whatever format the plattform offers and use a tool like Trados or Transifex to manually convert the different formats.
I'd recommend to use whatever format given platform has native, otherwise you will cause you lot of extra troubles.
You can then either use some tools to convert and merge these formats (translate-toolkit is great in this) or use some translation platform which will allow you to translate all of them in one interface. Transifex (service), Crowdin (service) or Weblate (service or instalable) should be able to do this.
Weblate can help you also with keeping them in sync, I don't think others have such feature (I'm author of Weblate).
I am a newer in using phonegap.
Could anyone tell me :How to preserve session in phonegap(or use anything else to preserve information)?
Just as what Asp.net do :Session["user"]="jack".
Lawnchair sits well alongside Phonegap to provide a nice interface to persistent clientside storage. Though Ram kiran is right and you could use the Phonegap storage API too.
I've been asked to recommend some alternatives to an interactive Flash cross-section, and I'm not sure of the best answer.
I'm tossing back and forth between HTML5 applications and native applications. The biggest benefit I can see for HTML5 is that only 1 version would have to be created and it could work on iOS and Android. The biggest benefit of a native application would be performance and compatability with older devices, however two applications would have to be created.
I'm leaning towards the native applications, because everything I've read suggests they'll just work better with less quirks, but the HTML5 route is intriguing and likely less expensive. Thoughts? Is HTML5 ready for something like that?
HTML5 is up to the task.
But that all comes down to what you're trying to support.
I mean, if you're trying to support iPhone 2, then you're going to have to go native.
There's no way around that.
Depending on what you're trying to do, you might be stuck supporting a minimum of an updated 3GS.
But it's not like there aren't native apps which don't do the same thing.
The same goes quadruple for Android. All iPhones are built to be the same, within the confines of that series.
There are no restrictions on how Androids are made, or what they contain.
As such, there's no guarantee that any app will work on all Androids.
In the end: it comes down to what you want to do, how you want to do it, and how familiar your devs are with each platform (and in the case of HTML5, that means all of the web-app APIs, and an understanding of deferred/async programming in JS, and how to work with the DOM in a high-performance way, plus media queries and touch-events).
PS: if you need to access internal file storage, or you need to access internal hardware (camera), or you need to access external hardware (bluetooth keyboard/wireless headset), use native apps. The APIs are there, but the support isn't guaranteed to be, yet.
I would suggest you OpenGL. It's fast (native code) and regarding animations and effects, you can do what you like.