Run JavaScript, jQuery, Ajax on PhoneGap Android App? - javascript

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.

Related

How to use Cordova

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.

How to load remote webpage on Android Hybrid App(the easy way)?

I have decided to learn how to create Android APK on windows for personal/learning use (Not for Android Play).
My design plan is to load a remote HTML page on android app and allow user to click a few links and then app make a post request to an API to get m3u8 of the video and play it !I already created the HTML web page and have the API access.
So could you guys point me to a beginner tutorial/example and what software and tools I need and which one is easiest to start with (to achieve my design goal)? (I installed PhoneGap but not sure if that is the only tool I need and if it is the easiest path. So I wait for your advice).
Furthermore, does installing java JDK creates any security issues for my PC? (since I heard lots of bad news about Java in past few years.)
If you are going with Phonegap, I would recommend you to first read the phonegap documentation so you can setup a basic phonegap project (phonegap). I would recommend to implement the site functionality inside phonegap instead of just loading an external site; this way you have access to more phone controls than from a web browser. But if it is really a requirement to load the external site, basically, the phone gap would load an empty page that would load your external site using the cordova inappbrowser plugin, here is the github page of this project (inappbrowser).

Using FileTransfer to download files in the background on a mobile application packaged with phonegap

I have packaged my jQuery/javascript application with phonegap for Android, and later plan to do this for iOS/BlackBerry. In this project, I implemented the FileTransfer.download function from the phonegap API to download a file from the server. The function is working successfully, but it blocks me from navigating to other pages within the app until the download is complete.
Maybe I'm missing something in the documentation: what's the best way to get FileTransfer.download to work in the background so that I can freely navigate page to page? Is it possible without resorting to device-specific code?
The solution I'm settling for is creating a plugin to call native code that does the downloading. In Android for example, I can create an AsyncTask to do the downloading in a phonegap plugin. I guess I'll be required to do something similar in iOS/BlackBerry/etc. Still welcoming others' solutions

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.

Phonegap app working locally, not working on phone

I have written a phonegap application, and it performs a pretty simple task, it gets some JSON from a YQL link, and then displays it nicely to the user. This works excellently when I run it using Google Chrome on a Desktop, but, my client tells me that it does not work on his device which is Android 2.3. What can be going wrong? I'm using phonegap build to build to app, and they tell me that it is given internet permission, but, when my client puts the APK on the phone (its not on the market yet), does he need to do something special for it to access the internet?
Thanks a lot,
Dhaivat
in phonegap, allow external host : Open phonegap.plist -> external host and add your url or * to allow all
within the phonegap app the webapp runs under the file:// protocol - this might affect things.
you should test this at least on an emulator yourself - clients usually screw up anything some might screw up when testing ;) best would be to test on an actual device tho.
I'm not sure if this will help but I had a similar problem testing my app here:
https://stackoverflow.com/questions/17496104/json-wordpress-feed-not-appearing-in-android-studio-emulator-using-phonegap
I needed to change access origin to ="*"/ in my config.xml

Categories

Resources