How to access native SQLite database with an application - iphone

I want to make an application for iphone, ipad, and android using HTML 5.
This application will create a SQLite database or place a prefilled SQLite database file when it is installed on ipad/iphone/android.
I want to keep it in a folder where my application is installed.
eg
ApplicationName- Files (where I have all the files for the application)
ApplicationName- DB (where I will have my sqllite database)
I want to connect to SQLiteDB using javascript.
Can I access the db at a particular location from my application using Javascript or jquery.
Can you suggest me some way I can get into this.

I would advise you to look at Apache Cordova (old Phonegap) to see how they handle things or use they own solution for this kind of thing.
But if you really want to walk alone, you need to build 2 sets of frameworks to call native code, or use web sql database(inactive) or something similar.
iOS
http://blog.techno-barje.fr/post/2010/10/06/UIWebView-secrets-part3-How-to-properly-call-ObjectiveC-from-Javascript/
Android
http://labs.mwrinfosecurity.com/blog/2012/04/30/building-android-javajavascript-bridges/

Related

Changing published mobile application developing language from ionic to flutter

I have a mobile application developed using Ionic. Now I want to redevelop it in flutter and publish a new update, would that be possible? will google play and AppStore allow that?
There is no constraint on development language. But,
You need to use same certificates/keys for iOS App
You need to use same key-store/keys for Android App
If you are using local database or file storage, then you should follow the same path in your newly created app as well. If you are using any third-party library to manage the db or file paths, then it may be in different location altogether. (This one actually happened to me. When I migrated my app from a cross-platform framework to Native the database path got changed in release version)

Possible to share SQLite DB between PhoneGap and Native code?

I am writing a native iPhone and Android app using Sencha Touch inside Phonegap and my client is very keen for me to include Analytics.
The application needs to function happily offline so I need an analytics solution that can remember activity occurring while offline and updating the server once online again.
My thoughts are to store events from within the JS to a store that can be checked at a regular interval on the device and posted to the server.
My question is whether a SQLite DB could be used for this using the Phonegap API and whether this DB could then be accessed from the native code?
I suspect not and that the best option would be to write to a text file.
Any thoughts or suggestions gratefully received.
The solution to this seems to be to write a Phonegap Plugin that lets you call a method from inside Phonegap to a method in your native application.

Client-server web app with both client AND server running on iPhone - is this possible?

I'd like to build a simple native iPhone app with tools traditionally used for web apps.
I would prefer to use something like jQTouch and Rails, but I want it to work offline (not require an internet connection or a server).
Is there a framework that enables simple creation of native iOS aps by encapsulating a lightweight web server and a server-side app framework (Rails or something simpler and more lightweight that can run on a phone), thus allowing you to write the client side code in HTML+JavaScript ?
If there is not such a thing, is there a way to create an app (with HTML+JS) that basically only has a client-side component with persistent data storage?
Thanks.
Have you tried Phonegap?
www.phonegap.com
You write your app in HTML/CSS/JavaScript.
You access the phones APIs through JavaScript - boom!
Also; Appcelerator Titanium would be an option: http://www.appcelerator.com/
-IMO Titanium is more powerful, and offers a more native look.
Why would you want to run a webserver off of the iPhone?
Is it so that you could send back data to the mothership?
Yes, you can included a lightweight http server running in another thread inside your iPhone app, and have your UIWebView connect to it. But unless you are going to do a fancier web server that generates dynamic content, it might be easy to just download your HTML/CSS/Javascript content to a local directory, and then point any URLs to those local files when offline.

How to use native sqlite in ios' webview?

I just want to develop an ios app based on webview. The offline storage must be used. I know that html5 offline storage is supported by webview. But I just want to use a native sqlite file(not the one embedded in webkit) just like other native ios app. So could anyone please give me some clues?
Are you implementing the database via javascript? If so check out this great free eBook on building iPhone apps. The chapter about Client-Side Database should give you a running start.
http://ofps.oreilly.com/titles/9780596805784/ch05.html#ch05_id35933084
regards
Andrew
webSQL is available in UIWebViews.
However, if you're using Cordova the convention is to use the SQLite plugin. GIYF.
I personally like using web storage wrappers for this. Lawnchair.js and persistence.js were earlier wrapper solutions, but I like using Mozilla's localForage the most. It makes storing any kinda JS primitive/object/blob really easy.
localForage is just a wrapper over localStorage, webSQL, and SQLite. It has a really simple API and will choose the best web db for you based on what you wanted to store (was it serializable: localStorage. was it a [file Object] from an HTML input: webSQL). Your project can be a Cordova project or whatever. Don't matta. It'll work.

How to Use PHP in IPhone Applications

I need to create an iPhone application using Facebook.
The facebook FBConnect API supports FQL which is similar to SQL Queries.
I would be able to create the application easily using PHP as compared to Objective-C.
So if there is any way to create an iPhone application using PHP please reply to me.
Thanks.
Well, if you are developing something for jailbroken devices , yes it is possible to use PHP (you have to install it first from Cydia).Also note that you should implement a SQLite database if your app/script needs database functionality (you can't run a MySQL server natively on iPhone ATM).
But, as pekka mentioned, this is a really bad idea, because you must set up first a lighttpd web server on iPhone (not really comfortable), or if you're planing to implement a CLI PHP script, you should first launch it (using some C functions like pipe(), dup2(), fork(), execl()) and then parse its output inside your -not-so-Objective-C- iPhone app.
So think it again...