我是开发phonegap的新手,所以如果这是一个明显的答案,我很抱歉.这是我项目的最后一部分,其中唯一不起作用的部分是插件.
我收到消息“无法通过Android Intent发送电子邮件”并在logcat中收到以下错误“错误:状态= 2消息=未在文件中找到类:///android_asset/www/phonegap-1.4.1.js:651 “
我无法弄清楚这一点,过去一天我一直在这里!
我已将插件添加到plugin.xml中
plugin name =“webintent”value =“com.borismus.webintent.WebIntent”
我有WebIntent.java文件的正确名称空间.
包borismus.webintent;
我在index.html中引用了webintent.js文件.
下面是使用该插件的功能.
function emailxmlfile(){
var subject = "Sports Code Xml Edit List" + filedate.toDateString(); var body = ""; if(!window.plugins || !window.plugins.webintent){ alert('Unable to find webintent plugin'); }else{ var extras={}; extras[WebIntent.EXTRA_SUBJECT] = subject; extras[WebIntent.EXTRA_TEXT] = body; window.plugins.webintent.startActivity({ action: WebIntent.ACTION_SEND,type: 'text/plain',extras: extras },function() {},function(e) {alert('Failed to send email via Android Intent');}); }};
任何帮助将不胜感激.谢谢
解决方法
我知道我可能会迟到,但是在没有轻微和微妙变化的情况下使用相同的代码:在将插件详细信息添加到.xml文件时尊重大写.我的意思是,你说过:
plugin name="webintent" value="com.borismus.webintent.WebIntent"
但应该阅读此内容(注意名称!):
plugin name="WebIntent" value="com.borismus.webintent.WebIntent"
一旦你纠正错字,Eclipse中的红色波形就会消失,而且代码工作正常,所以我可以调用我的电子邮件应用程序.
HTH!