I keep getting an error when using webintent

898 Views Asked by At

I am trying to open a webpage with cordova using this code:

window.plugins.webintent.startActivity({action: WebIntent.ACTION_VIEW,url: 'geo:0,0?q=' +            address}, 
function() {}, 
function() {alert('Failed to open URL via Android Intent')}
)

But I keep getting this error:

ReferenceError: WebIntent is not defined

Any thoughts?

1

There are 1 best solutions below

0
On

If you are using Cordova 2.0 make sure you have the following entry in config.xml:

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

also the WebIntent.java file needs to be stored in:

src\com\borismus\webintent\

Finally make sure you include webintent.js after the cordova.js:

<script src="cordova-2.2.0.js"></script>
<script src="js/webintent.js"></script>