[PhoneGap]How to preserve session? - android

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.

Related

How to control Network caching from my Flutter app?

For example, https://docs.flutter.io/flutter/services/NetworkImage-class.html says that cache headers are ignored. My understanding is iOS has an NSUrlCache on disk and it would be nice to be able to enable that. Similarly, I suspect Android has a disk cache which would be nice to enable.
Can I control Flutter's caching? Should I write my own disk cache/caching strategy in Dart on top of/in-front of NetworkImage?
We do not currently have a good way to do this, unfortunately. You could provide your own ImageProvider similar to NetworkImageProvider that had its own cache and implemented the network semantics correctly. We would certainly accept that as a patch if you contributed it. :-)

Portable Mobile/Tablet application proof of concept

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.

Are there any known localstorage compatibility issues with android webview

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.

How to write android code in titanium

I had been working on android since a little long. Now I am wondering about titanium. Is it possible to write android (java) code in titanium app since the app is build in titanium? If yes then how? Actually I am having problem dealing with push notification for android in titanium. So I got a solution to build complete app in titanium and then if possible use android code in app to deal with push notification. How? Please do response as quickly as possible. Thanks in advance.
To answer your question directly, you will need to develop a native Android extension to call Java code via JavaScript in a Titanium application.
Rai
You should be checking out the docs Here tells you all you need to know
Hope it helps
Frank
yes it is possible but remember that the titanium tools lag behind the official android ones. Documentation is poor and often wrong, code is laggy and the resulting .apk are much bigger.
Why are you thinking of using Titanium? For cross-compatibility?
If you are thinking about that you have multiple possible ways:
1) Build a minimum common denominator, like titanium, but better: Write a core application for both android and iPhone so that it will be fast and light on memory, with a modified broswer to show your content. This way the interfaces will be much easier and you'll have to write the content just once.
Still you will be able to access low level hardware, like GPS, compass, gyroscope.... easily without consuming too much battery (unlike with titanium) as needed.
2) Find an existing minimum common denominator: Javascript work both on iPhone and Android.
3) There are many other options (Adobe air, python, custom scripting, mobile web site, ...) but I think that the cons outweigh greatly the pros.

Accessing MySQL Directly from Android

I am currently developing an Android application. I want to be able to access MySQL from my website directory without needing to use JSON, SOAP or PHP in order to access MySQL. Is it possible to to import a MySQL connector into an android app.
Thanks for the help
You can use protoBufs instead by Google or use mySQL's connector example here but using the connector wouldn't be safe as #Shaun said in his answer. So it is possible.
Wow, I like how someone actually said its not possible. This is java we are working with isnt it? Its not easy is the answer. You can always take a java library already written for this in full out java, and rewrite it to work with android. The problem? Its not easy, thats why there is not a very well known library for it yet. Theres alot of connection issues, and security issues to think about when doing this from a phone. One, you dont have a dedicated stream of connection (meaning, your connectivity could drop at any moment) and your data could be corrupt, or, you query coudl have left out the LIMIT at the end you could whipe your database. Secondly, you have to worry about the security of your database. Phones are in no way the most secure devices out there, let alone android.
No this isn't possible. You'll require a web service front end.

Categories

Resources