I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
Current behavior:
I am trying to get an android Intent using Web Intent plugin. My code:
import { WebIntent } from '@ionic-native/web-intent';
constructor ( public webIntent: WebIntent ) { }
this.platform.ready().then(() => {
this.webIntent.onNewIntent().subscribe(
res => alert(res),
err => alert(err)
)
}
The result is the alert with error: "plugin_not_installed"
config.xml:
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent.git" />
package.json info:
"@ionic-native/web-intent": "3.7.0",
ionic info
@ionic/cli-utils : 1.2.0
Cordova CLI : 6.5.0
Ionic CLI : 3.2.0
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.2.1
@ionic/cli-plugin-ionic-angular : 1.2.0
Cordova Platforms : android 6.0.0
Ionic Framework : ionic-angular 3.3.0
Node : v6.9.2
OS : Windows 7
Hi
Have you solved it?
My question is the same as yours
Hi, I had to use something like this:
if ((<any>window).plugins)
(<any>window).plugins.intentShim.getIntent((intent) => {
if (intent && intent.data) this.intent = this.parseIntent(intent.data);
}, () => console.log("intent error"));
same problem here , @pe1o2pl solution worked by the way
By using that "solution" you are working around Ionic Native, you could just use the Cordova plugin directly then. This should probably be fixed in Ionic Native.
I am the author of the plugin at https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent which is referenced at https://ionicframework.com/docs/native/web-intent/ for WebIntent. This was changed in this commit https://github.com/ionic-team/ionic-native/commit/252c3e4a2146f2d994000212ddf1ec54f36e8b01#diff-178f84dc3d26f06ca16a617cec953cd9 from another plugin from a different author... I was surprised since I never tested the plugin with Ionic Native, I just developed a standard Cordova plugin. I am happy to make changes if required but from what I understand there is not anything I can do. As the previous poster said, you can invoke the plugin directly (via intentShim) but that is working around Ionic Native.
Plugins don't need to do anything to be "compatible" with Ionic Native, it is all on the site of Ionic Native.
Why this is breaking here then still has to be investigated though...
Thanks @darryncampbell for the plugin, i would like to use it with Ionic. Do you plan to add getUri() method to the api?
@pe1o2pl It looks like getUri() in the original plugin returned intent.getDataString(), https://github.com/darryncampbell/cordova-webintent/blob/master/src/android/WebIntent.java#L107. You can call getIntent() with my plugin to return a JSON representation of the calling intent; there is a 'data' extra in that returned intent which will be nearly the same as getUri() previously returned, https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/blob/master/src/android/IntentShim.java#L462. The difference is between getData() and getDataString(), let me know if getDataString() is required as well as getData(). Also, maybe continue this conversation in the plugin github repo.
Getting this error aslo:
Native: tried calling WebIntent.getIntent, but the WebIntent plugin is not installed.
@ionic/cli-utils : 1.13.1
ionic (Ionic CLI) : 3.13.2
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.7.1
System:
ios-deploy : 1.9.1
Node : v6.11.3
npm : 3.10.10
OS : macOS High Sierra
Xcode : Xcode 9.0.1 Build version 9A1004
Misc:
backend : legacy
Github issues is not the right place for problems and questions. Post at https://forum.ionicframework.com/
@janpio This is neither a problem nor question it's a bug, I'll upload a repo with this bug when I get the time.
@janpio Here is a repo with the error and steps to reproduce: https://github.com/hugodes/webintentfail
https://github.com/ionic-team/ionic-native/blob/master/src/@ionic-native/plugins/web-intent/index.ts#L32 should probably say window.plugins.intentShim as defined in https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/blob/master/README.md#intentshim.
Please try that locally and report back if it works, then you can just create a PR for that file yourself.
@janpio Indeed this fixes the installation error: #2062
However now, I get an error which is probably due to the definition of onIntent:

I updated the https://github.com/hugodes/webintentfail repo accordingly
This still mentions IntentShim.onIntent which should be window.plugins.intentShim.onIntent to work.
I don't know enough about Ionic Native on how to change and fix this locally.
@ihadeed?
Most helpful comment
Hi, I had to use something like this: