Geofence onNotificationClicked doesn´t compile


#1

The code I try to use is this one:

window.geofence.onNotificationClicked = function (notificationData) {
    console.log('App opened from Geo Notification!', notificationData);
};

But it seems to be written for ionic 2 projects, and in ionic 3 it throws this error

Type ‘(notificationData: any) => void’ is not assignable to type ‘() => Observable’

Do somebody of you knows if exist any update of this function for ionic 3 or what am I doing wrong?


#2

What Ionic Native plugin are you using?
What is your ionic info output?


#3

I am using geofence plugin:

Ionic info:
cli packages: (C:\Users\Usuario\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.10.2
ionic (Ionic CLI) : 3.10.3

global packages:

Cordova CLI : 7.1.0

local packages:

@ionic/app-scripts : 3.0.1
Cordova Platforms  : android 6.3.0 browser 5.0.1
Ionic Framework    : ionic-angular 3.8.0

System:

Node : v6.11.2
npm  : 3.10.10
OS   : Windows 10

#4

I don’t know much about this Ionic Native plugin, but windows.geofence is probably not used when interacting with it - this looks more like the Cordova plugin directly. You normally work with a object that is added via DI in the constructor to the class.


#5

I tried to do that without the window keyword, but the result is the same