Phonegap 1.4.1 Plugin WebIntent Android Class Not Found Error

I'm new to developing on the phone, so I'm sorry if this is the obvious answer. This is the last part of my project, the only part that does not work is the plugin.

I get the message "Failed to send email via Android Intent" and get the following error in logcat "Error: Status = 2 Message = Class not found in file: ///android_asset/www/phonegap-1.4.1. Js: 651"

I canโ€™t understand it, I was at it the last day!

I added the plugin to plugin.xml

plugin name = "webintent" value = "com.borismus.webintent.WebIntent"

I have the correct namespace for the WebIntent.java file.

borismus.webintent package;

And I have a webintent.js file specified in my index.html.

Below is the function that uses the plugin. 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');}); }}; 

Any help would be greatly appreciated. Thanks

+6
source share
4 answers

I know that I may be late, but the same code works for me without a slight and subtle change: respect capitalization when adding plug-in details to an .xml file. I mean, you said the following:

 plugin name="webintent" value="com.borismus.webintent.WebIntent" 

BUT, you should read this instead (watch the name!):

 plugin name="webintent" value="com.borismus.webintent.WebIntent" 

the red squiggle in Eclipse goes away as soon as you correct the typo and the code just works fine, so I can call the email application from mine.

NTN!

+6
source

Usually, when you receive this message, you skipped it to add the plugin to plugins.xml

 <plugin name="WebIntent" value="com.borismus.webintent.WebIntent"/> 
+4
source

Things change much faster when working with Android applications, it is too bad that most of the documentation is not updated as fast as it should.

I am using phonegap 2.0.0, and I had to add the plugin configuration to the config.xml file, not inside plugins.xml.

Make sure you download phonegap.js (cordova-2.0.0.js in my case), webintent.js and that you have the correct package structure in your src folder (src / com / borismus / webintent / WenIntent.java)

Then you should be tuned.

+3
source

You stated that the package:

 package borismus.webintent; 

but determined using:

 plugin name="webintent" value="com.borismus.webintent.WebIntent" 

You will not miss "com". in the package ad?

0
source

Source: https://habr.com/ru/post/912312/


All Articles