• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Code not working on android

ANDRN

Lurker
Feb 12, 2011
2
0
I am using the following simple code but its not working.

Here is the full code that I am using:
<!DOCTYPE HTML>
<html>
<head>
<title>Contact Example</title>

<script type="text/javascript" charset="utf-8"
src="phonegap-0.9.3.js"></script>
<script type="text/javascript" charset="utf-8">

function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}

function onDeviceReady() {
var element1 = document.getElementById('myname');
element1.innerHTML = "Ritesh";

var element2 = document.getElementById('deviceProperties');
element2.innerHTML = device.name ;

}

</script>
</head>
<body onload="onLoad()">
<p id="myname">Some text here</p>
<p id="deviceProperties">Loading device name</p>

</body>
</html>


And here is the console log:
[2011-02-15 10:45:51 - MyPhonegapAppL1] Android Launch!
[2011-02-15 10:45:51 - MyPhonegapAppL1] adb is running normally.
[2011-02-15 10:45:51 - MyPhonegapAppL1] Performing com.ex.L1.MyApp
activity launch
[2011-02-15 10:45:51 - MyPhonegapAppL1] Automatic Target Mode: using
existing emulator 'emulator-5554' running compatible AVD 'HelloAvd'
[2011-02-15 10:45:51 - MyPhonegapAppL1] WARNING: Application does not
specify an API level requirement!
[2011-02-15 10:45:51 - MyPhonegapAppL1] Device API version is 9
(Android 2.3.1)
[2011-02-15 10:45:51 - MyPhonegapAppL1] Uploading MyPhonegapAppL1.apk
onto device 'emulator-5554'
[2011-02-15 10:45:52 - MyPhonegapAppL1] Installing
MyPhonegapAppL1.apk...
[2011-02-15 10:45:55 - MyPhonegapAppL1] Success!
[2011-02-15 10:45:55 - MyPhonegapAppL1] Starting activity
com.ex.L1.MyApp on device emulator-5554
[2011-02-15 10:45:56 - MyPhonegapAppL1] ActivityManager: Starting:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] cmp=com.ex.L1/.MyApp }


But its not working. All I see is -
"Some text here
Loading device name"
And then the application exits. Can you please help me figure out?
Thanks so much in advance.

PS - I am using Eclipse/Phonegap on windows
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones