3

Hello I am writing a jQuery mobile app as part of a project.

I know that jQuery Mobile is widely used for cross-platform apps.

So I have one (maybe silly) question. In my computer a have all the files needed (jQuery Mobile, html files, css files etc.) and I test my app by viewing the html files from a web browser.

If I want to test the app in an Android phone (for example), what should I do?

Transfer the whole folder to my phone and view the html files from the browser or there is a way to build all the files and run it in the phone like an app?

Gajotres
  • 57,309
  • 16
  • 102
  • 130
Spyros
  • 682
  • 7
  • 18
  • 37

3 Answers3

2

Just upload your files to a web server. There are a few free options that are good for testing.

You can setup your PC as a server, and access it over your phone's wi-fi.

Mooseman
  • 18,763
  • 14
  • 70
  • 93
1

There are several solutions to your problem, I will enumerate them from the easiest ones to harder solutions.

jsFiddle

If you have an easy app you can test it in jsFiddle web tool. It can provide almost full jQuery Mobile functionality except form submitting and multi HTML support.

Here's a easy jQuery Mobile jsFiddle example: http://jsfiddle.net/Gajotres/yWTG2/

When you want to test it just go to the Share option and click full screen like this:

http://jsfiddle.net/Gajotres/yWTG2/embedded/result/

A good thing about jsFiddle is that you don't need to have a full HTML (like in my example), you can test it just with basic page HTML:

<div data-role="page" id="index">
    <div data-theme="a" data-role="header">
        <h3>
            First Page
        </h3>
        <a href="#second" class="ui-btn-right">Next</a>
    </div>

    <div data-role="content">

    </div>

    <div data-theme="a" data-role="footer" data-position="fixed">

    </div>
</div> 

Example: http://jsfiddle.net/Gajotres/fEV3J/

Hosting

If you have you own web hosting just upload your files and test it over the internet.

Local Web server

You can install a PHP web server package on your local computer and test everything in your local LAN. PHP is not needed for this, we only need an configured Apache server. While you can download it separately and install it by your self it is much easier to download prebuild package like:

Phonegap/Cordova app

Phonegap is a mobile app framework that servers as a wrapper between a native app and a web app. You can use it to create a hybrid mobile application, basically a web application that acts as a native mobile application.

I am not going to write any more about this solution because there are numerous other answers about this topic, but to make it easier for you here's my other answer regarding Phonegap and jQuery Mobile: https://stackoverflow.com/a/14166593/1848600

Community
  • 1
  • 1
Gajotres
  • 57,309
  • 16
  • 102
  • 130
1

You should use build.phonegap.com to upload your zip and it'll automatically give you the binaries required for different platforms, in your case, for android you'll get an .apk file easily.

If you want to test it locally on your system, install WAMP(for Windows), LAMP(for Linux) or MAMP(for Mac).

Also, install Google Chrome. Then, install Ripple Emulator for Chrome : https://chrome.google.com/webstore/detail/ripple-emulator-beta/geelfhphabnejjhdalkjhgipohgpdnoc?hl=en . You can emulate different devices inside Ripple. AFAIK, for Ripple, you may not even need WAMP/LAMP/MAMP. It reads from the file system directly.

Kazekage Gaara
  • 14,972
  • 14
  • 61
  • 108