Ulhas Tuscano
Ulhas Tuscano

Reputation: 5620

PhoneGap sample application for android does not work

I am trying to learn Mobile app development using Phonegap for Android platform. So, I downloaded latest PhoneGap version 1.6. I found a nice article at http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart which shows how to set up PhoneGap for Eclipse. After adding sample application in Eclipse i am now able to run the application but, None of the list items seems to be working neither on my emulator nor on my phone. The sample application contains a list(As shown in the link Example) i.e Get Location,Beep,Vibrate,Call 411,Take a Picture,etc. Only call 411 is working what's wrong with the code or phonegap?

logcat

04-19 05:45:01.538: I/CordovaLog(325): Changing log level to DEBUG(3)
04-19 05:45:01.538: D/DroidGap(325): DroidGap.onCreate()
04-19 05:45:01.559: D/DroidGap(325): DroidGap.loadUrl(file:///android_asset/www/index.html)
04-19 05:45:01.559: D/DroidGap(325): DroidGap: url=file:///android_asset/www/index.html baseUrl=file:///android_asset/www/
04-19 05:45:01.958: D/DroidGap(325): DroidGap.init()
04-19 05:45:02.078: D/PluginManager(325): init()
04-19 05:45:02.178: D/SoftKeyboardDetect(325): Ignore this event
04-19 05:45:02.358: D/SoftKeyboardDetect(325): Ignore this event
04-19 05:45:10.470: D/CordovaLog(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:10.470: D/CordovaLog(325): file:///android_asset/www/main.js: Line 21 : TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:10.499: E/Web Console(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object. at file:///android_asset/www/main.js:21
04-19 05:45:15.108: I/Database(325): sqlite returned: error code = 14, msg = cannot open file at source line 25467
04-19 05:45:21.128: D/CordovaLog(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:21.128: D/CordovaLog(325): file:///android_asset/www/main.js: Line 25 : TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:21.128: E/Web Console(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object. at file:///android_asset/www/main.js:25
04-19 05:45:22.908: W/KeyCharacterMap(325): No keyboard for id 0
04-19 05:45:22.908: W/KeyCharacterMap(325): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
04-19 05:45:26.228: D/CordovaLog(325): TypeError: Result of expression 'navigator.network' [undefined] is not an object.
04-19 05:45:26.228: D/CordovaLog(325): file:///android_asset/www/main.js: Line 108 : TypeError: Result of expression 'navigator.network' [undefined] is not an object.
04-19 05:45:26.249: E/Web Console(325): TypeError: Result of expression 'navigator.network' [undefined] is not an object. at file:///android_asset/www/main.js:108

Upvotes: 3

Views: 8924

Answers (3)

Naresh
Naresh

Reputation: 69

it's worked for me but make sure add only first line in your indext.html file not second line. for me after deleting second line only it is worked. add only

add make sure cordova-1.7.0.js exists in www folder.

Upvotes: 0

sravan
sravan

Reputation: 5333

I think You have spelling mistakes in your code, or else missed some attributes like charset="utf-8"

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

<script type="text/javascript" charset="utf-8"> 

Upvotes: 1

Paul Beusterien
Paul Beusterien

Reputation: 29547

Likely the name of phonegapjs or cordovajs in your index.html does not match the file name in the assets/www directory.

The AppLaud Eclipse plugin that I created, provides a wizard to configure projects for PhoneGap for Android. See http://wiki.phonegap.com/w/page/34483744/PhoneGap-Eclipse-PlugIn-for-Android

Upvotes: 6

Related Questions