Call OneSignal commands from a provider/service

When using OneSignal, what is a recommended way to retrieveTags as an Observable in a provider?

retrieveTags(): Observable<Object> {
        return this.OneSignal.push(["getTags", function (tags) {

However, I get error:

browser_adapter.ts:181 EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error during instantiation of GettingStartedPage!.
ORIGINAL EXCEPTION: TypeError: this.OneSignal.push(…).map is not a function…

Basically I am trying to call OneSignal commands from a service/provider.


It looks like you’re using our web SDK. This does not work from mobile devices since the it requires native code to subscribe the app for push notifications. See our setup guide below for our Cordova / Ionic SDK setup.

Our documentation for the getTags Cordova/Ionic SDK is below.