Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use AJAX calls with Android?

I'm a C# web-developer. And on a daily basis I'm very comfortable using jQuery and making AJAX calls for data (which I love). However, I am a complete NOOB to Android. My current reading shows Android uses REST'ful services for data-exchange.

So my question(s) are...

Can Android use jQuery mobile?
Can you make normal AJAX calls in Android?
Can you ONLY make REST'ful calls in Android?

like image 760
Prisoner ZERO Avatar asked Jan 26 '26 06:01

Prisoner ZERO


2 Answers

Classic Android development is done in Java. jQuery is largely useless here, as jQuery is for JavaScript, not Java.

However, through tools like PhoneGap, it is possible to create Android applications that are written in HTML, CSS, and JavaScript. In this case, you are welcome to use jQuery Mobile, Sencha Touch, or any other mobile-flavored library you want.

With that in mind:

Can Android use jQuery mobile?

Only if you are creating a PhoneGap application (distributable through the Market) or are creating a plain HTML5 Web app.

Can you make normal AJAX calls in Android?

Since AJAX, by definition, is a browser concept, it is the same answer as above.

Can you ONLY make REST'ful calls in Android?

You can do whatever your little heart desires, so long as you find a Java library (or JavaScript library, for PhoneGap/HTML5) that supports it. Android tends to use plain HTTP requests versus SOAP or XML-RPC, simply because most of the interesting stuff online is accessed via plain HTTP requests.

like image 115
CommonsWare Avatar answered Jan 27 '26 22:01

CommonsWare


You can use a WebView if you want to use jQuery. The browser is what calls the javascript (jQuery) obviously Android isn't a browser, it's an OS.

like image 31
dotty Avatar answered Jan 27 '26 21:01

dotty