How to use Cordova - javascript

I'm currently trying to use Cordova to build an ios app and I've already had all the pages of my app done in separate HTML files such as "add_entry.html" and "inbox.html". But it seems like when I tried to run my program through "cordova emulate ios" in my terminal, it only runs the index.html file that was built for cordova.
Is there a way to get it to run the other html files I made instead of index.html?
I'm very new to using Cordova so please let me know if you're having trouble understanding my questions..
Thank you!

cordova emulate ios will emulate your entire website. You just have to make the index page link to your other pages. You specifically need an index.html file in a Cordova application, which will be the first page that you see when you load up your application.
All website need an index, and you cannot circumvent that.
Keep in mind that ios emulation (and build process) is only possible through XCode on an Apple Mac computer. Android emulation and development is possible on Windows (with cordova run android). You may be looking for PhoneGap to help you with this.
Hope this helps!

looks like you try to run cordova on a normal pc with windows or linux.
you can't compile a ios app with cordova in emulator. for compiling ios apps you have to buy an apple computer. perhaps phonegap build is an option for you.

Related

Run JavaScript, jQuery, Ajax on PhoneGap Android App?

Is it possible to use JavaScript, jQuery and Ajax on a PhoneGap App for Android? And if so, how can this be possible? Because, when I run my index.html on Mamp, it works. But when I run it on my local machine, it does not work.
So my question is - will my project run on a PhoneGap App for Android?
And if so, how does this work? Does PhoneGap Apps have some kind of a integrated Mamp (or something like that), that emulates a webserver?
I have tried to google it, but can not find a answer.
I'm sorry, but I don't have a Wifi at home right now, so I got to wait some weeks before I can deploy my test on Android over PhoneGap.
I just would like to know right now, if it works or not - and when it works, how it can work.
Thanks!
Phonegap does not have integrated MAMP, it is not a web server. Think of it as more of a web browser -- PhoneGap only runs web assets like HTML, JS, CSS. You would then make your ajax calls to your MAMP server from your PhoneGap app to deliver data.
Just give it a try, PhoneGap has low barrier to entry and this will be the best way to see how it works.
Getting Started with PhoneGap.

Debug Cordova Plugin

How do you debug the non-js portion of a cordova plugin? I have found several discussions on Stack Overflow, but none of them have given me an answer on how I throw my plugin into an IDE, and be able to breakpoint it.
Debugging the JS is no problem and makes sense, but I have no idea how to either print out a log from the android/ios side or hit breakpoints.
I am in the process of making a small change to InAppBrowser to allow Cookie read/writing and I desperately need to know how to monitor this.
Any help would be vastly appreciated.
Create a new cordova project
cordova create debugPlugins com.debug.plugis debugPlugins
go to the new folder
cd debugPlugins
add ios and android platforms
cordova platform add ios android
and the inAppBrowser plugin (or any other you want to debug)
cordova plugin add cordova-plugin-inappbrowser
When you added android and ios platforms, two native project where created, you can open and debug them.
For ios, go to platforms/ios and open the debugPlugins.xcodeproj
For android open android studio, go to File->New->Import Project and select the platforms/android folder

Phonegap.js is not found

I have a problem with my Phonegap application. I got a 404 error on phonegap.js
I understand that the compiler (I'm using Phonegap build) will replace the src of my phonegap.js by the real path but I don't get that.
It's weird because I have all the other scripts loaded but not this one.
This screenshot is from Safari, debugging my application launched on my iPad to give you more details.
I'm using Phonegap 3.1.0 with an iPad Retina 64 bits with iOS 7.0.
Edit: I can't use Phonegap 3.4.0, Phonegap build is still not supporting it.
Thanks in advance !
Think of phonegap.js as the runtime. It only exists when your app is running on a device.
If you are previewing your app on a local web server, you will get 404 because the local runtime is not your device (its your laptop).
To solve this, developers have invented tools like PhoneGap emulate (http://emulate.phonegap.com/) where you can use an emulator to 'mock' certain behaviors in your local runtime that would occur on a device.
Thanks guys but the problem wasn't related to Phonegap. I copied from our desktop version and that created the problem. And as I wrote in my comment, the screenshot is from Safari debugger for my iPad, not from a browser tab.

Recording a Call in PhoneGap?

Are there any Plugins available for Recording a Call in Android using PhoneGap? Or some guidance on how to implement it!
Thanks.
I don't think that this is possible at all. I hope the phone will protect the calls from beeing recorded by any app.
This is not a matter of phonegap.
edit
I found some apps, that can record calls at android phones.
Basicly it would be like audiorecording:
http://docs.phonegap.com/en/3.0.0/cordova_media_capture_capture.md.html
The only thing would be to detect the phonestate. Now the trouble may start, because your app is send to background and maybe will be paused.
There's not one that I can find.
Here's the documentation on creating a plugin for phonegap 3.x:
http://docs.phonegap.com/en/3.0.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide
And here's a tutorial on writing a plugin for phonegap 3.x:
http://devgirl.org/2013/09/17/how-to-write-a-phonegap-3-0-plugin-for-android/
You'll need to have this file stucture
src
android
ios
www
plugin.xml
You can also put more platform folders inside of src depending on which ones you want to support. plugin.xml includes all of the instructions for phonegap to be able to automatically install the plugin for each supported platform.
Here is an example of a plugin that's been upgraded to Phonegap 3.x.

Is it possible to get this facebook plugin working with pure phonegap app

This might be really a basic issue. I am kind of confused. I don't understand one thing. Phonegap app is pure html5 and javascript. But for this plugin (https://github.com/davejohnson/phonegap-plugin-facebook-connect/tree/master/example/HackBook) to work we need separate java code for android and xcode for ios.
I got the java version of the android tutorial working with the simulator but when I just copy the assets folder to build a pure phonegap app. it does not work.
Then it beats the purpose if i still have to maintain 2 code lines.
Does just the html and JavaScript code in this plugin is not supported by phonegap app without java or xcode.
Here is my phone gap app. you can download it. https://build.phonegap.com/apps/211586/share
My code in the git repositiry is here
https://bitbucket.org/sunmeet/phonegab2.0_fbapi
PhoneGap Build service only Supports ChildBrowser , Barcode Scanner, Google Analytics recently.
if you try to use any external plugin which needs assets other than HTML / CSS / JS, you can't use them with PhoneGap Build Service. But, PhoneGap Team are trying to push out different plugins like Facebook Connect in Future Releases.
So, here they gave two Options to Deveopers.
Use Child Browser and Do Process Facebook OAuth Authentication.
Build Locally.
Andriod developement environment is "Eclipse" IOS
developement environment is "XCode"(OS: MacOS)
I Suggest you to work with first option and once plugin is our from build service its really easy to integrate anytime.

Categories

Resources