- using PhoenGap 2.2.0
- Done \ bin \ create C: \ Temp \ Test com.test Test
- Had the following conclusion
Microsoft (R) Windows Script Host version 5.8 Copyright (C) Microsoft Corporation. All rights reserved.
Creating new android project... Building jar and js files... Copying template files... Copying js, jar & config.xml files... Copying cordova command tools... Updating AndroidManifest.xml and Main Activity...
- Imported Project
- File> New> Project> Android> Android project from existing code
- Selected folder C: \ Temp \ Test
- Checked "Copy project to workspace"
- Alteration
- Checked res \ xml \ config.xml and the string
<plugin name="Notification" value="org.apache.cordova.Notification"/> present
- Checked that index.html contains Cordova-2.2.0.js
- Case # 1 Opened index.html and changed from
<script type="text/javascript"> app.initialize(); </script>
to
<script type="text/javascript"> function showAlert(msg){ navigator.notification.alert(msg); } document.addEventListener("deviceready", showAlert('You are the winner!'), false); app.initialize(); </script>
I get the following error 11-25 10:29:58.399: E/Web Console(14604): Uncaught TypeError: Cannot call method 'alert' of undefined at file:///android_asset/www/index.html:40
- Case 2 Open index.html and changed from
<script type="text/javascript"> app.initialize(); </script>
to
<script type="text/javascript"> function successAlert(){} function errorAlert(){} function showAlert(msg){ cordova.exec(successAlert, errorAlert, "Notification","alert", [msg]); } document.addEventListener("deviceready", showAlert('You are the winner!'), false); app.initialize(); </script>
I get the following error 11-25 10:25:06.575: E/Web Console(14149): Uncaught TypeError: Object #<Object> has no method 'exec' at file:///android_asset/www/index.html:42 }
I'm sure I missed something ... I just can’t conclude what it is. Please help me.
javascript android cordova phonegap-plugins
javadevg Nov 25 '12 at 18:49 2012-11-25 18:49
source share