Phonegap - confused about Android and IOS - android

I am using PhoneGap and Framework7 (UI) for my app. The app will be deployed on IOS, Android and Windows.
The app needs to play audio and also record audio. I will be using alot of javascript code for checking user answers and adding user scores.
My problem.
I looked at a few tutorials and examples. I am really confused.
I am using the latest version of PhoneGap. I am using PhoneGap Desktop to create a new project. I also downloaded the PhoneGap app to run it on my device. (All working)
My confusion.
I see in some tutorials it says this.
In order to create a PhoneGap project for Android, all you have to do
is run the command to add a platform to the project: $ phonegap platform add android
Do I need to add this too? I have created a build for the android version using PhoneGap Build (www.build.phonegap.com)
Do I have to change my app structure to accommidate both IOS and Android?
Is there a way to build for IOS on PhoneGap build without a certificate/key from Apple? I just want to test the app and see if its working on IOS. I am still in the beginning stage of development.
Thanks in advance

The PhoneGap Desktop / Developer app combination, while great, is not a perfect representation of how your app will behave when built and installed on its own. You will need to do further testing to ensure your app works as expected.
The templates usually come with all the core plugins installed. These will ask for far more permissions than your app actually needs. You'll need to remove these from config.xml at some point prior to production.
config.xml is the preferred mechanism now for indicating which platforms and plugins are required by your app. Any missing platform or plugin will be automatically installed by any of the build tools (CLI or PhoneGap Build). See the Cordova documentation and PhoneGap Build documentation for more information.
PhoneGap Build determines which platforms you want to build for by looking for <platform name="..."> tags in your config.xml file. If you have none, all platforms are built, but at some point you'll need to limit this to the platforms you intend to target.
Note: IF you have the CLI installed, you can add platforms and save them in your config.xml by using cordova platform add --save android.
The same applies to plugins. Note that the PhoneGap Developer app only supports core plugins and a few third-party plugins.
You do not usually need to change your project structure to support iOS and Android. You may need to handle quirks that are present on each OS, but you should be able to do so using the same code base.
You cannot build an app on PhoneGap Build for iOS without having the requisite certificate and provisioning profile from Apple.

Related

I developed an android application with cordova and I want to convert it to iOS as well

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.

How to combine Cordova, Crosswalk and Ionic framework

I'm trying to create a mobile application which combine the above projects and I'm not sure how should I do it.
Here are 2 options which I found:
Use https://github.com/MobileChromeApps/mobile-chrome-apps - My problem with it is that it seems that it's not production ready. (I was told that it is but I can't find any support for that).
Create a new ionic project, then add Cordova to it followed by empting the platforms/android/CordovaLib/ folder and moving into it files from Crosswalk (as explained at https://www.thepolyglotdeveloper.com/2014/10/use-crosswalk-ionic-framework-android-apps/) - This solution is quite simple but seems a little hackish for me...
Which option should I use? are there any other options?
Cheers,
---- Update ----
Ionic have incorporated the ability to combine Crosswalk in their own CLI, check it out at http://ionicframework.com/blog/crosswalk-comes-to-ionic/
Regarding Crosswalk
Crosswalk support is something that we hope will be available to vanilla cordova by default before the end of the year. You can start experimenting with this today by following the work on the cordova-android 4.0 development branch. It should be possible to add this platform (and the required plugins) directly to a new ionic project.
Chrome Apps for Mobile are cordova-cli compatible and do indeed already bundle Crosswalk by default. The primary difference with vanilla cordova is that applications must follow the Chrome Packaged App structure (have a manifest and background script), but gain the benefit of running on Desktop Chrome. See longer answer here. (I wouldn't read too much into the developer preview label.. we just like calling everything beta ;)
The current crosswalk-project.org provided cordova workflow does not use a cordova multi-platform application structure. It uses the cordova-android native app template directly. This means you will not be able to use the cordova cli, nor downstreams like cca or ionic. You will also obviously not be able to add other platforms, will have a tougher time upgrading, and managing plugins is a bit more complicated (you have to use the plugman tool directly).
There is currently no option for developing using cordova+crosswalk that is not without some tradeoff.
Regarding compatibility between Cordova, Ionic, Chrome Apps for Mobile (etc) projects
Most cordova downstream projects are "mostly" cli compatible. E.g. The cca cli (used by Chrome Apps for Mobile) supports commands like create, plugin add and platform add -- so it will work to install ionic plugins. Vice versa is also true, Chrome Api's for Mobile are developed as cordova plugins which can be added to an Ionic or cordova project using their respective cli's.
Most downstreams also use the same project directory structure (plugins/, platforms/, www/, hooks/, etc), so you can usually mix usage of the various cli's within one project to some degree.
That said, the reason cca needed a custom cli is because we do a few non standard modifications to your cordova project that aren't directly supported by vanilla cordova (yet). Ionic does the same.
I've suggested at various cordova meetups that downstream projects like Ionic, PhoneGap, and CCA, should play better together -- so your question is right on the money. We are mostly-compatible but finding out the differences is currently left as an exercise to the developer.
Using XDK HTML5 Cross platform Development IDE is probably the best way of integrating Crosswalk, Cordova and Ionic. It has built in support for Crosswalk. I have recently used it and its totally awesome. It will make our work a lot easier.
From Crosswalk site:
If you prefer to use a graphical integrated development environment (IDE), the free Intel XDK provides an alternative way to package applications for Crosswalk Android. See the Intel XDK website for more details.
This guy on youtube produced a nice, straight-forward tutorial that worked for me: https://www.youtube.com/watch?v=0I1OjJLVLMo
The results are fantastic, worth the struggle to get it working.
The guy says CrossWalk makes a big difference on anything running less than Android 4.4 (when Chromium was added).
Good luck.

Do you need to install both cordova and phonegap?

I am trying to get started with phonegap/cordova for developing mobile apps.
Still a lil confused by the getting started part of the website
http://docs.phonegap.com/
In one place,CLI installation instructions, they say to install cordova.
IN another place,Phonegap installation instructions, they say to install phonegap.
What's going on here? Do we need both? What is the difference in roles of each one?
PhoneGap is a distribution of Apache Cordova. You can think of Apache Cordova as the engine that powers PhoneGap, similar to how WebKit is the engine that powers Chrome or Safari. (Browser geeks, please allow me the affordance of this analogy and I’ll buy you a beer later.)
Over time, the PhoneGap distribution may contain additional tools that tie into other Adobe services, which would not be appropriate for an Apache project. For example, PhoneGap Build and Adobe Shadow together make a whole lot of strategic sense. PhoneGap will always remain free, open source software and will always be a free distribution of Apache Cordova.
Currently, the only difference is in the name of the download package and will remain so for some time.
more
The PhoneGap CLI is built on top of the Cordova CLI. It has all of the functionality that the Cordova CLI has. The main difference is that the PhoneGap CLI has PhoneGap Build integration. So if you don’t have the native SDK installed, you can delegate compilation to the PhoneGap Build cloud service and get app-store ready mobile apps. Both tools are completely interoperable.
No, you don't. PhoneGap should include all of the commands that Cordova provides. It provides a cloud-based build feature, which Cordova does not.
The documentation on phonegap.com would benefit from clarifying its use of 'cordova' vs. 'phonegap'. Right now, it is too easy for new developers to get confused over which commands are relevant.

What is the role of phonegap build in phonegap app development

Being a newbie to phonegap development I have question for which i have not been able to find the answer yet. I have developed an using Xcode and phonegap. I used the IOS simulator and my iphone as a test device. After getting the development certificate, I could install the app using Xcode on my phone to test the app. I also submitted the app to the app store via Xcode.
I obviously want to deploy my app on other platforms like the android and windows. I know I can submit the app to phonegap build and it returns me all the executable files for different platforms.
But, instead of developing the app for IOS, if I had developed the app for android, I assume that phonegap build will give me a .ipa file.
How can I submit the app developed for android using phonegap submitted to the apple store for distribution.
Thanks for your help in advance.
Great question. I think the heart of this question lies at the differences between PhoneGap and Cordova. Cordova is sometimes thought of as the Open Source version of PhoneGap, but in reality, Cordova is the Open Source core of PhoneGap.
What does this have to do with PhoneGap Build? I'm getting there. When Adobe wanted to Open Source PhoneGap, they wanted to keep the branding for a few value added features that they could monetize. The Apache foundation had them rebrand the open source version, which is now known as Cordova, and Adobe retained the rights to use PhoneGap for their value added features, one of which is PhoneGap build. The PhoneGap Build FAQ might be useful info.
But, instead of developing the app for IOS, if I had developed the app for android, I assume that phonegap build will give me a .ipa file.
Actually, no. When you're developing with XCode for iOS, XCode itself produces the .ipa based on the Cordova (PhoneGap) template project. If you were to build for Android for instance, you would produce a .apk, which is, more or less, the Android equivalent of a .ipa. If you were to develop for Windows phone, you would produce a .xap file. The one problem with you doing this yourself is that you would need to have a template project for each of the different ecosystems that you then set the configuration, and add your resources to the www folder (or equivalent). This could be tedious, and a little time consuming. To make this process a little easier for developers, in comes PhoneGap Build, designed to take care of this step for you. You give them your universal PhoneGap app, based on your HTML, CSS and JavaScript (and possibly a little money, depending on your price plan), and they return you the signed apps, ready to be submitted. Awesome!
So in reality, there is nothing in PhoneGap Build that you couldn't do yourself (given enough time and effort), but they just make it easier for you to focus on the important thing, solving your original problems, and not spending time dealing with builds.
So to answer your final question, you have two choices: Use PhoneGap build to have it generate (pretty much) everything you need for both Android and iOS (As well as others), or set up new Template Projects for each, and drop in your resources in the associated www folder, and build it yourself. Check out the PhoneGap Download and the projects for the different platforms.
If you have any questions, comment on this answer, and I'll try to update as needed.
Update 1
Yes, PhoneGap Build provides app-store ready builds (See second advantage).
Get app-store ready apps without the headache of maintaining native SDKs. We do the work for you in the cloud and your app will always be built with the most up-to-date SDK for the platform you are targeting.

How to generate build for android mobile?

I have installed PhoneGap in my mac and I am able to select PhoneGap project template using Xcode. Now I my doubt is, how can I deploy the application on Android device?
Do I need to set up Eclipse and need to install PhoneGap Sdk again?
Can't I develop it on one platform and get the build for other mobile devices?
Yes you need to configure cordova on seperate platforms if you download the libraries.
Although you can use https://build.phonegap.com/
To just write code once and you will get the respective installable files for the mobile platforms.
I agree with above answer. But if you keep developing apps using Phongap you better you Install ecplipse and sdk. Then add following plugin
http://www.mobiledevelopersolutions.com/
It will generate you entire set up for application. You need to replace www folder.
Make your you also replace correct cordova js file. Because it needs to be the one created for Android.

Categories

Resources