In Ionic v2, I have native push working perfectly with phonegap-plugin-push
In Ionic v3, however, all of the native-push syntax has changed a lot.
For example, in Ionic v2, you do this:
push.on('registration', (data) =>
But in Ionic v3, it sems that you have to do this because native-push has been rewritten with observables (or promises):
push.on('registration').subscribe((data: any) =>
However, I cannot figure out how to make push.finish() work correctly though.
In Ionic v2, this works:
push.finish(function()
{console.log("success");},
function() {console.log("failure")},
some_numeric_variable
);
In Ionic v3, it says "Supplied parameters do not match any signature of call target."
The documentation is not helpful, it does not give any information regarding this.
Can anyone give an example on how push.finish() should look?
I see that in @ionic-native\push\index.d.ts it shows finish defined as:
finish(): Promise<any>;
It is missing all of the input parameters, we have to be able to pass the ID value into it so that IOS knows when a background process is finished.
Here is the definition from the old ionic-native v2 that was working:
finish(successHandler: () => any, errorHandler: () => any, id?: string): void;
This means that the method now returns an promise.
this.push.finish()
.then(successHandler)
.catch(errorHandler);
returning a promise isn't the issue... there seems to be no way to send the notID to it. That's the entire purpose of .finish, to send the notID so that IOS knows a certain process has finished.
Notice that it should be something like this:
finish(successHandler: () => any, errorHandler: () => any, id?: string): void;
(the "id?: string" is important)
In the new version, it is like this:
finish(): Promise<any>;
(The parenthesis for input values are empty!)
I'll fix this soon.
You can still do something like this at the moment:
(this.push as any).finish(id);
Any news on that guys?
Most helpful comment
Any news on that guys?