Can I use third party PhoneGap plugin on a web page using iOS Safari browser? - iphone

I am developing an application targeted only for iOS device(for now) using PhoneGap library and HTML5. This application is going to be only a web page accessed through iOS Safari browser. I am going to use certain features like accessing accelerometer, geolocation, contacts etc of iOS device using PhoneGap library.
Will I get access to all these features without installing anything on the device.
I want to understand how does PhoneGap get access to native features
of the device by just using JavaScript only?
I see there are several useful plugins written for PhoneGap library.
Can I simply use those plugins(js files) into my page without
installing anything on the device? E.g PhoneGap ChildBrowser plugin?

Will I get access to all these features without installing anything on the device.
You will have to build as a native ios app and install it to the device.
I want to understand how does PhoneGap get access to native features of the device by just using JavaScript only?
Phonegap provides a Javascript interface to access hardware features which are actually Objective-C functions. If you look at Phonegap source you'll see a lot of Objective-C code. So it's not only Javascript.
I see there are several useful plugins written for PhoneGap library. Can I simply use those plugins(js files) into my page without installing anything on the device? E.g PhoneGap ChildBrowser plugin?
No. They have to be inside an iOS app to be able to work.

It seems like what your after is a way to access the features of an APP only through the browser.
You can access some things using HTML5 e.g.:
Geo location http://html5demos.com/geo
Accelerometer http://menscher.com/teaching/woaa/examples/html5_accelerometer.html
Video Embedding http://www.w3schools.com/html5/html5_video.asp

Related

Does Ionic compile the Code to Native?

I've searched some times here but could't find an Answer to this.
Does someone know this and can explain how Ionic handles it?
Does Ionic compile the Code to Native? NO
Ionic is for developing Hybrid apps.
What are Hybrid apps?
Hybrid apps are essentially websites embedded in a mobile app through
what we call a webview. They are developed using HTML5, CSS, and
Javascript, and execute the same code regardless of the platform in
which they run. They can, with tools like PhoneGap and Cordova, use
the native features of a device, like GPS or camera.
What are Native apps?
Native apps are developed in the language required by the platform it
targets, Objective-C or Swift for iOS, Java for Android, etc. The code
written is not shared across platforms and their behavior varies. They
have direct access to all features offered by the platform without any
restriction.
Here is a nice article about it.
Cordova converts the project into a native which has only ONE Page, that is a WebView (WKV WEB View in iOS, etc). And all of the ionic code is run on that webview. Basically an ionic/cordova app is a website which looks like an app!

Can you add platform specific code in PhoneGap?

If I have an application build using PhoneGap is it possible to add to it platform specific code?
For instance, for an iOS version I would like to add Heatma.ps SDK.
Heatma.ps SDK is an iOS specific static library written in Objective-c.
yes you can add as much platform specific code as you want. Phonegap is just for the interaction of the platform specific code and the javascript. Its the plugin mechanism that makes Phonegap what it is. Even if you have a native app, you can add a bit of Phonegap in it by having a page somewhere which is basically a webview and is manipulated by js. Phonegap is what launches and manages the interactions of the js and the native part of the app.

How to deploy a jquery-mobile web app to an Iphone store app

I have built a Jquerymobile webapp , I want to take it a step further, build additional features and deploy it as an iphone app. I am confused on connecting these two dots. I looked at Phonegap and Titanium. Phonegap does not allows to register yet and Titanium seems like I have to code everything again using Titanium apps . Any ideas on how to bridge the gap of connecting iphone app and jquerymobile.
I use phonegap for my iPhone apps and it works well. Phonegap Build will even encode the iPhone (and Android, Blackberry, etc) app for you so you don't have to use Xcode.
Phonegap download 0.9.6: http://www.phonegap.com/download-thankyou
How to start an app using Xcode and Phonegap: http://www.phonegap.com/start
signup for Phonegap Build: https://build.phonegap.com/
Can you just take your already written JS code and use it as your source for a UIWebView? Those middle-ware platforms you mentioned have their own JS libraries you need to use, but if the code you already made will work as-is on an iPhone, dumping it into a UIWebView should be all you need to do.

By using PhoneGap can we convert iphone app to android app?

Can we build an iphone app and convert the application to the android application using phonegap framework?
I have been through various links.
We basically need to develop a webapp for that and that can be converted to an android app or an iphone app respectively.
I am an iphone application developer and i am not at all familiar to android.
Links or example code would be greatly appreciated.
PhoneGap will not enable you to "port" an existing iphone application to Android. However, if you develop an application within the PhoneGap framework (which means using html, css and javascript), you will be able to deploy it on multiple mobile platforms such as iPhone, Android, Nokia, Blackberry, etc.
The downside is that you will eventually be developing a packaged mobile website - your application consist of html pages, css styling and javascript behaviour/logic, combined whith access to phone internals such as gps, disk, database, camera, etc. It will usually not "feel" fully native on most platforms. For example, you will not be using the system's "native" ListView.
There are javascript libraries such as JQuery-mobile, JQTouch, etc, that make your application look nicer on mobile devices, but it's still not as good as the native experience.
The app you build will not be a native Android or IPhone app but a HTML Web App wrapped in the PhoneGap wrapper and packaged into a native app. So yes you can build for both platforms as long as you build a Web App
Edit -(a Web App is just a plain html/css/javascript + server-side(php, asp etc) website)

Is there a way to automate conversion of web app to iphone or android native app?

I came across this link:
http://ofps.oreilly.com/titles/9780596805784/
which seems to suggest web app can be converted to native iphone without writing a single line
of objective-c code. But the book mentioned there is outdated now and things may have changed a lot.
Are there open source software that will allow me to automatically convert my web application to native iphone ( or android) application? By the way my web application is html5 canvas based animation application with lot of html and css as well.
PhoneGap doesn't generate native code for you: it creates an application consisting of a WebView and throws your HTML code on it. From personal exerience I can add that the performance is quite slow, on both iPhone and Android, compared to a native app.
jqTouch creates a nice way to access your web application, but the application remains a web application residing on your site, plus you have to use some jquery for styling.
Apparently the only one that actually does generate native code is Appcelerator Titanium. On RhoMobile I never managed to get to the point to actually write some Ruby code because you have to know all the Ruby in he word just to install it on your Mac.
So the verdict was to sit down and develop the app in objective-c.
Have you looked at PhoneGap?
Simple steps to put your html app into iOS native container, without coding:
Download xCode
Download simple web view app from https://github.com/nomtek/iOSWebViewApp
Open simple web view app within xCode
Add your HTMLs to the project file structure
Run your app and voila :)
This approach is good if you don't need access to any phone specific features, just a standard Web View. Loading time will be short as this approach doesn't load any extra libraries.