It's difficult for me to explain my problem because my english is not good, hope you would understand.
This is my first try to make a mobile game, all done and I want to show ads by AdMob. I have tried some PhoneGap AdMob plugins such as admob-phonegap , cordova-admob-pro , etc,.. but all of them give "undefined" error on variable named "admob" (or "AdMob") .
There are the step I try with PhoneGap:
Install NodeJS.
Install Cordova.
Install PhoneGap.
Create app by command: phonegap test_app
cd test_app and phonegap platform add ios
Add plugin for my test_app by command: phonegap plugin add [plugin_name] (also try with cordova plugin add [plugin_name])
Write some html to test the AdMob plugin:
document.addEventListener("deviceready",function(){
try{
if(admob){alert("OK!");}
}catch(e){alert(e);}
},false);
8. Start test_app on my computer by command: phonegap serve.
Install PhoneGap Developer (http://app.phonegap.com/) App for my iPhone and connect with my computer, all work fine expect the "admob" variable is not defined !
I am using Windows 8 and there are not software be installed before (include Java,...)
Thank you for understanding and helping me.
Your are using Cordova or PhoneGap command line tool locally, you need install Java and Android SDK first.
If you don't want to install Android SDK locally, you can use PhoneGap Build service, which is a commercial cloud build service offered by Adobe. Or else you can try Intel XDK, which is a IDE and another could build service.
To use AdMob you have to build it into APP and install APP to device or simulator. As it will pack plugin which contains native code.
Running PhoneGap serve and use browser to visit it, only load html5 and JavaScript code, it won't work.
Related
I have an Angular project web app, which is running successfully in the Apache web server after I built it with "ng build ..." command. Now, I want to make it Android App, for that, I tried to use Cordova. First I create a Cordova project then under www directory, I placed dist files from NG. Yes, I also used the Cordova platform add android before that. But, when I install apk in an emulator or on a real device it is appearing blank.
I google and found many links but none of them worked for me. Maybe I am doing wrong. Please guide me.
You need to be change base url at your dist folder and i don't suggest cordova for angular. You can choose the Nativescript for mobile apps and it's native. Because Cordova plugins are not very compatible with Angular.
I have created android project in eclipse, added cordova.js and cordova-2.9.0.jar file and created index.html to develop mobile application. On running this app, it by default runs in android emulator.
How can i see output of other platforms like ios,windows??
Lets work through your questions which is not even very detailed.
First of all, update your cordova. 2.9.0 is an old version. To do so just run
Mac:
sudo npm update -g cordova
Windows: (run cmd as administrator)
npm update -g cordova
After you did that, i would recommend you to read the very detailed documentation of cordova which can be found over here: Cordova Documentation.
Finished with that? Good, then you should know now, that there is now way to deploy an iOS App from your Windows Computer to your iPad or iPhone. This is only possible on a mac. Because the applications are just "rendered Websites" you can open up the index.html files inside your browser.
cue browser... there is a platform, which is called browser. This is a much better than the normal browsers. You will find a documentation for that over here: Browser Documentation and Information. It can be installed via
cordova platform add browser
I'm using the PhoneGap Developer App to instantly test my apps and since tonight the app says 'DOWNLOADING', and then a few seconds later is says 'DOWNLOAD ERROR'. After that, a popup appears saying
Unable to download archive from the server. Please upgrade the PhoneGap CLI or check your network settings.
So, how do I upgrade the PhoneGap CLI and what settings should I check? I haven't changed any network settings and the PhoneGap Developer App worked fine on my Macbook and iPhone, but now it says this.
What's the problem and how do I solve it?
EDIT
I now realise that this is happening now because the PhoneGap Developer App for iOS has been updated (now version 1.5.2). I've upgraded the PhoneGap CLI to version 5.0.0-0.28.0, which is the recommended version according to this blog post from PhoneGap
Seems like there's something going wrong with the new way the Desktop and Mobile app now communicate.
THE SOLUTION:
Download the newest version of the PhoneGap Desktop App from the official website. So you have to update the PhoneGap Developer App for mobile, the PhoneGap CLI and download the newest PhoneGap Desktop App.
For me starting the local server from PhoneGap CLI helped. The thing is that for some reason using the PhoneGap Desktop doesn't fire a special Windows dialog to permit some actions for the app.
You should try to run manually in a cmd window the command phonegap serve to trigger the firewall request to open by Windows (if you are on Windows). You can also see the log. Leave the window open.
I changed the port from 3000 to something else and it worked.
Probably had something else listening to it.
While using WiFi, Your computer & device has to be on the same network.
I got the same problem and fixed it updating the phonegap.
Update your phonegap npm update -g phonegap or sudo npm update -g phonegap if root is required.
Also update your Phonegap CLI in your mobile.
I had to install node.js and it's working now.
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.