Note that there are some explanatory texts on larger screens.

plurals
  1. POPhonegap not working in Android emulator
    primarykey
    data
    text
    <p>I followed all the steps in the basic Phonegap tutorial (Eclipse, Android SDK, ADT Phonegap), I created an HMTL page in the assets/www folder, ran it, and it showed my <code>hello world html</code>.</p> <p>Step 2: I added a reference to jQuery Mobile on a CDN in my HTML page: it worked.</p> <p>Step 3: I created a new html page, copy-pasted the code below, which is a sample from the Phonegap site, and it does... nothing. Not even an alert (I added some alerts to see if something happens, but even the onDeviceReady event doesn't fire.</p> <p>I have the Phonegap JAR in place, the <code>cordova-1.7.0.js</code> in my <code>assest/www</code> directory, but something is probably missing.</p> <p>Can someone help me out? </p> <p>I also tried another sample from the Phonegap site (the 'device properties' sample), but it still doesn't work.</p> <p>It's a fresh Eclipse install, I've set the Android version to 2.3.3 and I'm using Phonegap 1.7.0.</p> <p>================</p> <h1>EDIT</h1> <p>I tried some more, and I now can reproduce the error, but don't know why it happens.</p> <p>So I created a new project with the Phonegap example project, it works.</p> <p>So, I copied all the assets from that project (1 html, 2 js and 1 css) to my projects, let the app start with that html (from my activity class), and it works.</p> <p>And now for the fun part (not): I reset the startpage to my 'old' index.html (which is jQuery mobile), and then clicked on a link to the example html, it does NOT work.</p> <p>So example html as startup: it works, example html opened via the link: does NOT work.</p> <p>And when I loaded my other html pages which didn't work as start page, instead of opening them via the start page, they work too.</p> <p>So, is it possible that my jQuery Mobile-powered index page causes trouble ? (I'll copy-paste the code below).</p> <p>EDIT2: When I use a non-jQuery Mobile index page and I link with a normal <code>&lt;A href&gt;</code> link to the example html, it also works. So that's hinting more and more to the fact that I think jQuery mobile is in my way...</p> <p>The link code is this:</p> <pre><code>&lt;li&gt;&lt;a href="index4.html" data-transition="none"&gt;phonegap example&lt;/a&gt;&lt;/li&gt; </code></pre> <p>The jQuery Mobile home page:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&gt; &lt;link rel="stylesheet" href="http://www.verfrisser.net/kalender/mobile/verfrisser.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;De NerdNight kalender&lt;/h1&gt; &lt;a href="about.html" data-rel="dialog"&gt;About&lt;/a&gt;&lt;a href="genereren.html" data-transition="pop"&gt;Genereren&lt;/a&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;div data-role="content"&gt; &lt;img id="verfrisserlogo" src="verfrisserlogo.png" /&gt; &lt;ul data-role="listview" data-inset="true" data-filter="false"&gt; &lt;li&gt;&lt;a href="2011.html" data-transition="none"&gt;2011&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="2012.html" data-transition="none"&gt;2012&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="2013.html" data-transition="none"&gt;2013&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="testing.html" data-transition="none"&gt;testing&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="testing2.html" data-transition="none"&gt;testing2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="testing3.html" data-transition="none"&gt;testing3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="index4.html" data-transition="none"&gt;phonegap example&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;div data-role="footer"&gt; &lt;h6&gt;(C) Verfrisser 1998 till now&lt;/h6&gt; &lt;/div&gt;&lt;!-- /footer --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>================</p> <p>The sample HTML (which only shows the text 'A dialog box will report the network state' in the page)</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;navigator.network.connection.type Example&lt;/title&gt; &lt;script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; // Wait for Cordova to load // document.addEventListener("deviceready", onDeviceReady, false); // Cordova is loaded and it is now safe to make calls Cordova methods alert ('stand alone'); // function onDeviceReady() { alert ('onDeviceReady'); checkConnection(); } function checkConnection() { var networkState = navigator.network.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unknown connection'; states[Connection.ETHERNET] = 'Ethernet connection'; states[Connection.WIFI] = 'WiFi connection'; states[Connection.CELL_2G] = 'Cell 2G connection'; states[Connection.CELL_3G] = 'Cell 3G connection'; states[Connection.CELL_4G] = 'Cell 4G connection'; states[Connection.NONE] = 'No network connection'; alert('Connection type: ' + states[networkState]); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;A dialog box will report the network state.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload