Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it work with Android Phonegap 3.3.0 ? #9

Closed
kardin opened this issue Dec 25, 2013 · 5 comments
Closed

Does it work with Android Phonegap 3.3.0 ? #9

kardin opened this issue Dec 25, 2013 · 5 comments
Labels

Comments

@kardin
Copy link

kardin commented Dec 25, 2013

I created new Android project with phonegap 3.3.0 using the cmd interface. I can run the phonegap on my android phone. Tried to follow your instruction to install the plugin email composer but I every time I run the code window.plugin.email.open(); I got this error

Uncaught TypeError: Cannot call method 'open' of undefined:43

Below is my index.html

<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<div class="app" onclick="emailme();">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/email_composer.js"></script>
<script type="text/javascript" src="js/index.js"></script>

<script type="text/javascript">
app.initialize();
function emailme(){
window.plugin.email.open();
}
</script>
</body>
</html>

email_composer.js already put inside "js" folder

What should I do ?

Thanks

@katzer
Copy link
Owner

katzer commented Dec 25, 2013

You lead the plugin in the wrong way. Do not lead the plugins directly.
If you install a plugin through the command line interface, they will be listed in the cordova_plugins.js file which is loaded by cordova.js.

@katzer katzer closed this as completed Dec 25, 2013
@kardin
Copy link
Author

kardin commented Dec 25, 2013

Thanks for your reply. Can you tell me what I did wrong? I checked file cordova_plugins.js and see nothing reference to your email composer, here is the code I got:

cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [];
module.exports.metadata = 
// TOP OF METADATA
{}
// BOTTOM OF METADATA
});

Should I modify this file to make it work? what should I write in here?

Thanks

@katzer
Copy link
Owner

katzer commented Dec 27, 2013

Please use the following steps:

  1. cordova create Project ...
  2. cd Project
  3. cordova platform add android
  4. cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git

@kardin
Copy link
Author

kardin commented Dec 27, 2013

I found the bug. Your instruction says call the javascript like this:

window.plugin.email.open();

This is wrong for me, and to make it works I have to remove "email", this is the code works for me

window.plugin.open();

Hope this help someone.

@manukv
Copy link

manukv commented Jan 6, 2014

Thanks @kardin .. Im using Cordova 3.1.0, window.plugin.open(); works for me.. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants