I am a beginner in developing with phonegap. For about 12 hours I have been trying to connect an AngularJS application with phonegap, in order to develope a mobile app for android. Unfrotunately, AngularJS does not seem to work for me. This is a link to my github repository, where I have pushed all the code from the www folder of the phonegap project. Basically I have everything linked to my index.html file, routes and controllers seem to look ok. I have done several angular.js applications before, but always with node.js, so this thing is really new for me. Sorry for posting the whole project, but I have been working on this long enough to have absolutely no idea where the problem is. I really tried everything I could...
Angularjs is definitely the best framework which gives us the facility to develop client application using great MVC framework.
Here is some links i have referred while i was developing phonegap app using angularjs first time.
divgirl 2013
divgirl 2014
coenraets 2013
coenraets 2014
These are the best for reference if you are talking about phonegap & angularjs
I was looking for the same thing a few days ago and I found this grunt project:
https://github.com/dsimard/grunt-angular-phonegap
I am assuming you have:
installed phonegap, generator-angular, grunt
made a phonegap project
added angular in your project by doing 'yo angular'
did a 'cordova platform add android'
Here is what you need to do next:
npm install grunt-angular-phonegap --save-dev
npm install (both 1. and 2. should be done once inside project directory)
grunt phonegap:check
(it checks if it can build in your system.
checkAdb will probably fail if you are using windows but you don't have to worry about that)
grunt phonegap:build
P.S.the regular command is grunt phonegap:command[:platform] but by default it does android.
That's it.
Thanks to https://github.com/dsimard for the awesome tool.
Related
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.
Hi I need to develop a simple application which is hybrid which runs in kitkat version of android. Since it is possible with PhoneGap 3.3 I have been trying to install it.
But I am really confused a lot with the installation procedure.
First I installed nodejs in my windows 7 32 bit system.
Then I ran the commands from the phonegap website. This is the link http://phonegap.com/install/
I was able to create a project.
But I am facing an error and not able to start the emulator.(I set the environmental variable. )
Then I have gone through couple of ohter websites where they said to run the following commands.
C:> npm install -g cordova
And if I run any further command beyond that it is asking me to install Apache ANT.
But many folks said me that both phonegap and cordova are same.
So I am a little confused since I have to ask my superiors for the download and installation of software in my office PC.
Please suggest me any website that gives me the procedure to work on these.
Phonegap and cordova uses almost the same repository,but they are not the same.Phonegap is build on top of cordova.
Cordova's releases a version first and phonegap usually follows.
The main difference between the both is that phonegap allows you to build your app online
https://build.phonegap.com/
Both have very different documentation
Here's a link to cordova http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html
And link to phonegap http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html
If you notice the links in the phonegap plugin in the documentary,you will notice phonegap uses cordova's plugin
Phonegap constantly plays catch up with cordova.I am a little biased towards cordova.I suggest you decide which is better for you
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.
For more details you can read these blogs
PhoneGap, Cordova, and what’s in a name?
And this question on stackoverflow
Is there a difference between PhoneGap and Cordova commands?
I have been tasked with developing an Android and iOS application with PhoneGap (http://phonegap.com/)
However, as I read, things start to get really complicated: Some people say Cordova (http://cordova.apache.org/) is now PhoneGap, others say PhoneGap is just a distribution of PhoneGap.I lost 3 days and still can't find a proper way or a guide to install a fully functional PhoneGap plugin either in Eclipse or Netbeans running Ubuntu 12.04 64-bit.
What I tried:
1. Installing Eclipse, installing MDS AppLaud Phonegap Plugin (http://marketplace.eclipse.org/content/applaud-phonegap-android-jslintjshint#.Utf1JPiSTh8). This one actually installed at once, and it actually lets me create a new PhoneGap project in Eclipse, however, the I cannot select any SDK different than 4.4. (?!)
2. Installed NetBeans and after I tried to install phonegap and cordove through nodeJS it failed, again.
My question is:
Which one I should install and how to do it in Ubuntu, using either Eclipse of NetBeans?!
Edit:
OK guys, I just found out how to install nodeJS and PhoneGap on Ubuntu 12.04: http://paste2.org/1OnX6M6F . Still trying to integrate it in some IDE for the real thing, though!
If you want to basically start developing an app, I suggest this for PhoneGap:
These are the steps I used to install PhoneGap on Ubuntu. Take note, this is for PhoneGap version 2.8.1. Personally I was not able to get nodeJS to install the latest. If you need the latest to be installed, check around on google. Referencing This tutorial.
Step 1
Install Java 7 JDK
Step 2
Install ANT
Step 3
Download & Extract PG v2.8.1
Step 4
Download Android SDK
Step 5
Set up environment variables
Step 6
Create base project
./create location/to/put/project package_name project_name
Step 7
Import Project into Eclipse
File->New->Android->Android Project From Existing Code
Browse to where you placed the project and select it
Now you can start developing.
Reminder: This is the way to do it for v2.8.1 of PhoneGap. Different versions(especially 3.*) will be different (nodeJS)
Look at http://docs.phonegap.com. Read the "Overview chapter, then "Platform Guides" and "The Command-Line Interface". Follow the steps and in the end you should be able to build your app. It takes a while but it's worth it.
I havn't integrated cordova/phonegap in my IDE. I just created the app with the command line interface. In netbeans I created a HTML5 project and linked the app-root/www directory into this project. I'm programming with Netbeans and building and running the app with the command line interface. That's all.
In order to have some code completion, I have written an extra class (facade) which encapsulates the phonegap code. It just delegates its calls to the phonegap API. That is especially nice if the phonegap API changes as it only affects my code in that particular facade class.
The last thing I want to share: I found out that the build and run process with the command line interface is pretty slow. Executing cordova prepare android and then running the android project in Eclipse/ADT is a lot faster.
OK, to put it simple:
PhoneGap - The original project developed by volunteers
Cordova - The Apache's version of Phonegap, which has exactly the same documentation and functionality as the original PhoneGap but is integrated in NetBeans 7.4.
I am starting with PhoneGap but I am totally lost : I followed the getting started tutorial, so I've got ADT bundle (android SDK + eclipse + ADT plugin), i used create.bat in cordova to create a default project and I can run it on my device from eclipse.
The point is that the tutorial stops there, and in the default project there isn't any HTML/JS file, everything is java/xml like a normal android project.
So i made a new project from existing sources and this time I used PhoneGap (still don't understand what the heck is the difference with Cordova and if I need both or not) so I selected the "example" folder in phonegap for my existing source.
Now I've got a project with some jar files, but also an assets/www folder with index.html and main.js so this seems fine to get started : the point is that I can't find any tutorial for android which explains how to build an app from that.
Also, Ecplise opens index.html in a kind of WYSIWYG view (without editing) and there isn't any switch to html code editor.
Do I need to install Eclipse Web Platform or anything ?
And please can someone here who understands all that more clearly help me out ?
Thanks
Firstly, on the Cordova / PhoneGap thing: originally, a company called Nitobi developed PhoneGap. They were then acquired by Adobe, who open sourced the framework under the Apache Foundation - this is what's known as Cordova. Adobe are continuing to develop the commercially-branded PhoneGap, providing services such as PhoneGapBuild around that, and are also continuing to contribute to the Cordova project which remains at the core of PhoneGap.
You're right that almost all your development once you've got going happens inside the assets/www folder - that's where all your HTML, JavaScript and images etc will live.
In Eclipse, you can install the web developer tools by going to Help -> Install New Software, and expanding the "Web, XML, and Java EE Development" group, then checking "Eclipse Web Developer Tools" and "Web Page Editor (Optional)". Much more detail in: https://stackoverflow.com/questions/54868/what-is-the-best-html-editor-for-eclipse
In terms of an ongoing tutorial, one of my colleagues is currently working his way through blogging an example of building a very simple CRM system using Cordova; you can find these posts at http://www.vsnomad.com/tag/dtw-crm-sample/. The blog assumes you're using Nomad, which lets you develop Cordova projects within Visual Studio, but if you ignore the VS bits, the HTML and JavaScript should still be applicable to you.
(Obvious disclosure: I work on the team building Nomad for Visual Studio. Hopefully the sample is of genuine use even if you're not using the product though!)
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!