I would like to use PhoneGap - Cordova for developing HTML5 + javascript application that will display sensor data on both win8 and android.
I have a basic question which I didn't understand from my research in the web.
what is the structure of such application? I mean, how to build this cross platform application in one project only?
what I see in phone gap - getting started guide http://docs.phonegap.com/en/2.5.0/guide_getting-started_index.md.html#Getting%20Started%20Guides
and many other websites, is that the working mode is to open a project, for example in VS2012, for OS specific. but I want to use this project for win8 and android!
I'll appreciate any help, especially if you have code samples for it and maybe some useful tools\templates to open this project.
note: I'm new to HTML5-javascript.
gin,
the structure is you would be coding using jQuery,java script,CSS,resources and your basic HTML.
The HTML API and the CORDOVA's java script will integrate with the native plugins of Phonegap.
We can create our own plugin's,we have a format for it there in the same website.
You need to create different projects for each platform if you decide to build the app locally. For example, you need to create an Xcode project in a Mac machine to develop an iOS app. If you are ok to do cloud build, you can check out http://build.phonegap.com where you just need to upload your zipped html/js and css files and it will give u ready to run apps for iOS, Android, Windows mobile, BB etc...
Related
I developed an android application with cordova and I want to convert it to iOS as well. Before starting my project I heard that we are able to convert same project with multiple platforms using cordova. But now I don't know how to convert my project to IOS. Can any one suggest good tutorial OR examples to do it.
And also mention what are all prerequisites to convert my android application to IOS using phone gap.
Suggest me some tutorials with examples.
First, you'll need an actual Mac computer. I suggest a MacBook Air, as they are cheaper than an iPhone. Then purchase an Apple developer license (USD 100/year) if you plan to submit this app to the App Store. Finally, you can migrate your Cordova source code to Xcode to compile the iOS version as explained in this guide:
Build Cordova iOS app from Visual Studio for Windows
The artice explains how to create a new app in Xcode and then export your source code from the Windows PC to the Mac. You can safely ignore all references to Visual Studio if you aren't using it, because it's not needed: Just follow the steps from the For your iOS app section.
I have created an ios app using Xcode .Now I have to make it run on android also.So I downloaded phonegap 2.0 and create an xcode project using commandLine(./create ~/Desktop/newfolder com.companyname.projectname projectname).After that I added all the required classes and storyboard file of allready created ios project to this new one(created by using Phonegap utilities).
And now I can run this project.What I want to know is ,
Is this the correct way to make my ios app cross platform?
Is there any rule that only app created using CSS html5 and
javascript can be made crossplatform using Phonegap?
If my steps are wrong do I need to create the same project using CSS html5 and javascript again for making it cross platform.
You can't achieve such functionality using PhoneGap, here is the wikipage for PhoneGap
It says that it enables software programmers to build applications for mobile devices using JavaScript, HTML5, and CSS.
PhoneGap has different builds for different architectures, so once you've written your entire app using HTML5, CSS and JavaScript you can make build for every different platform available.
If you want to port iOS project into android it is not possible but if you want to port a HTML5 application you can do it using PhoneGap.
Create a PhoneGap project for android using command-line interface. Have a look at the Cordova Command-Line Interface.
Add the CSS, Javascript, HTML, image files inside respective folders. Also, add plugins required for the application using the command-line interface.
Hope it helps you.
First off the bat, if you're looking to port an existing Objective-C based iOS project then it is not possible to do so with PhoneGap.
PhoneGap or Apache Cordova as it is known now is not the only framework that can be used to write cross platform apps. I personally think it is one of the more well supported ones (being an open platform) and yes it is based on familiar web technologies i.e. HTML + CSS + Javascript and you are limited to using only this combination but then web frameworks are good enough for most development requirements these days. This is a good place to start off with Cordova development.
Cordova 3.x.x onward has matured well as a framework and post creation of a project one can add platforms using the command line interface (CLI). This is the common structure of a Cordova project :
/hooks /merges /platforms /plugins /www config.xml
The /www folder contains the web app that you're developing, typically :
/img /css /js index.html
The /platforms folder contains the projects for the various platforms that you've requested, typically :
/android /ios
It is these folders that contain the projects that need to be imported by the IDE that you're using. Say, for Android, import the contents of the android folder as an Existing Android Code Into WorkSpace and build it normally as an Android project. That is all.
Nonetheless, it has many limitations like the lack of support for in app billing, 3D graphics etc. I would like to suggest that you consider making native apps for all platforms you intend to support.
I am developing currently for IOS and Android SDK. So each time i have to do an app i have to develop for 2 separate platforms which take much time. Also i am planning to develop on BB , Windows Mobile etc. I came across Phonegap and i had some questions.
First suppose i am developing on MAC OS and Xcode 4 and i have install the required SDK for phonegap i create a project using the template and start coding in HTML5/CSS3. Once the project is completed how to import it to Android platform? Should i start to create a project and adding phonegap libraries and required jar and right away i can copy paste the HTML5/CSS3 from the www folder scripts into the required directory /assets/www ? If that's the way it suppose to do then i will have to do the same for BB and Windows (of course on a Windows machine) we can do the same?
Many thanks.
build.phonegap.com will build all the needed apps from your web content.
Say I'm a windows dev, familiar with Visual Studio and with a need of developing an Andriod app. I looked at both the andriod and wp7 getting started guides, but found the windows phone version http://phonegap.com/start/#wp guide much simpler than the Android version (of course, as a windows dev I have already everything installed).
Then comes my question:
Could I develop my app using the Windows Phone environment, and then use the PhoneGap Build services to get the Android version build?
In case, what should I upload to the build service?
Sorry if I got this all wrong, and thanks for any help!
Larsi
The whole idea of phonegap is to develop a multi platform app writing the code once.
So the answer is yes, you should be able to build the app for wp, and then re-use your code for all the other platforms, only if you onlyuse the phonegap API and do all your programming in JS, HTML and CSS.
About what you should upload, I haven't doned it myself, but I think that It would have to be all the JS, HTML and CSS from your app. In android all is located on a folder called "assets".
Good Luck!
just wanted to clear a confusion concerning phonegap,
My area of interest is mainly Android and Iphone. What I really understand about phonegap is that the phonegap app is platform independant when no native libs are ysed and thus run both on iphone and android. Thus if i build an android app on eclipse using phonegap without using any native libs, will it run on iphone as well??
Nope, this is not exactly the case.
Phonegap enables you to write cross-platform code (HTML, JS, CSS), but when it comes to building, you have to compile this code to a specific environment for each OS. For example you can build the Android version using eclipse, and the iOS version using Xcode.
Hope this helps!
No, you will still need to build for iPhone as well.
You can use the same source code for all systems.