One Signal Problem


Hi, I installed the One Signal plugin and I’m creating a page for notification settings. I can not access the getPermissionSubscriptionState method.

I pass correctly in costructor

private _SIGNAL : OneSignal

and then

		.then(() =>

In the method i configure options like this



      // Retrieve the OneSignal user id and the device token
      .then((ids) =>
      {'player_id', ids.userId);
         console.log('getIds: ' + JSON.stringify(ids));

      // When a push notification is received handle
      // how the application will respond
      .subscribe((msg) =>
         // Log data received from the push notification service
         console.log('Notification received');

      // When a push notification is opened by the user
      // handle how the application will respond
      .subscribe((msg) =>
         // Log data received from the push notification service
         console.log('Notification opened');
	  .then((msg) {
      // End plugin initialisation

but this is not working :getPermissionSubscriptionState

I do not understand why :sob:

Property ‘getPermissionSubscriptionState’ does not exists on type ‘OneSignal’

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 6.5.0
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.1.2
    Ionic Framework                 : ionic-angular 3.4.2


    Node       : v6.7.0
    OS         : Windows 7
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.3

I’ve installed the latest plugin

Any ideas?


Tell us what “OneSignal”/_SIGNAL is in your code.


_SIGNAL is the name of the Onesignal plugin instance, like platform or others:

constructor(private storage: Storage, public navCtrl: NavController, private _PLATFORM : Platform, private _SIGNAL : OneSignal) {
		.then(() =>



Ah sure, now my crystal ball can tell me if this method you are calling is actually present in the plugin. Or if it really works. Or how it works.
Oh wait, I lost my crystal ball this morning.
(Please provide a link and a version you are using)

Also: Where and how are you testing?


I’m using the latest version of the plugin:

onesignal-cordova-plugin 2.1.2 “OneSignal Push Notifications”

I’m using the command ‘ionic serve’ and i receive the compilation error listed above .

Before adding this, i tried the application on android device and i’m able to receive notification.

The method getPermissionSubscriptionState is listed in documentation:–getpermissionsubscriptionstate-

I’m new with Ionic and angular JS :slight_smile:


All the functionality will only work on devices, no with ionic serve.


Obviously, but i receive a compilation problem, during transpile. If I execute the command ‘ionic cordova run android’ , it exit

C:\Cremona_Circuit>ionic cordova run android --verbose
[DEBUG] Loading global plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for global @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
Running app-scripts build: --address --port 8100 --p 8100 --livereload-p
ort 35729 --r 35729 --iscordovaserve --externalIpRequired --nobrowser

[16:45:24]  build dev started ...
[16:45:24]  clean started ...
[16:45:24]  clean finished in 30 ms
[16:45:24]  copy started ...
[16:45:24]  transpile started ...
[16:45:30]  typescript: C:/Cremona_Circuit/src/pages/home/home.ts, line: 89
            Property 'getPermissionSubscriptionState' does not exist on type 'On

      L89:  this._SIGNAL.getPermissionSubscriptionState()
      L90:  .then((msg)  =>

[WARN] Error occurred during command execution from a CLI plugin
       (@ionic/cli-plugin-cordova). Your plugins may be out of date.
Error: Failed to transpile program
[DEBUG] Error: Failed to transpile program
        at BuildError.Error (native)
        at new BuildError
        at transpileWorker
        at Object.transpile
        at buildProject



Are you sure the OneSignal you are using isn’t The way your code looks like normally isn’t used for Cordova plugins alone…


Yes, it is. The One signal plugin is inside an ionic app. And the method getPermissionSubscriptionState is listed inside the documentation


Please post your package.json content and ionic cordova plugin list output.
Also show the import of OneSignal.



  "name": "Cremona_Circuit",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/background-geolocation": "^3.12.1",
    "@ionic-native/core": "3.10.2",
    "@ionic-native/facebook": "^3.12.1",
    "@ionic-native/geofence": "^3.12.1",
    "@ionic-native/geolocation": "^3.12.1",
    "@ionic-native/in-app-browser": "^3.12.1",
    "@ionic-native/onesignal": "^3.12.1",
    "@ionic-native/splash-screen": "^3.10.2",
    "@ionic-native/status-bar": "^3.10.2",
    "@ionic-native/youtube-video-player": "^3.12.1",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.4.2",
    "ionicons": "3.0.0",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
  "devDependencies": {
    "@ionic/app-scripts": "1.3.7",
    "@ionic/cli-plugin-cordova": "1.4.0",
    "@ionic/cli-plugin-ionic-angular": "1.3.1",
    "typescript": "2.3.3"
  "description": "An Ionic project"

ionic cordova plugin list:

> cordova plugin ls
? Running command - done!
cordova-plugin-add-swift-support 1.6.2 "AddSwiftSupport"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-geofence 0.7.0 "geofence"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-mauron85-background-geolocation 2.2.5 "CDVBackgro
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-youtube-video-player 1.0.6 "CordovaYoutubeVideoPl
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
onesignal-cordova-plugin 2.1.2 "OneSignal Push Notifications"

One Signal import on file home.ts

import { OneSignal } from '@ionic-native/onesignal';


Ok, so you ARE using Ionic Native.

3.12.1 is the current version, so your library should match the current documentation.
The code for that method exists on the plugin:

So why isn’t this working for you… hmm…


So I found out that the docs for [quote=“AntonioCC, post:1, topic:94981”]
[/quote] are not correct, and opened an issue about it: But that has nothing to do with your error.

Could you replace getPermissionSubscriptionState with foobar and tell me the error message?

I’m pretty much out of ideas here…

[10:06:41]  build started ...
[10:06:41]  transpile update started ...
[10:06:41]  transpile update finished in 40 ms
[10:06:41]  deeplinks update started ...
[10:06:41]  deeplinks update finished in 40 ms
[10:06:41]  webpack update started ...
[10:06:46]  typescript: C:/Cremona_Circuit/src/pages/home/home.ts, line: 89
            Property 'foobar' does not exist on type 'OneSignal'.

      L89:  this._SIGNAL.foobar()
      L90:  .then((msg) =>


Okay, so exact same error message.

Can you look into /node_modules/@ionic-native/onesignal if the getPermissionSubscriptionState is in there (as it should be)?


I found something… inside folder node_modules/@ionic-native/onesignal and file index.js, there’s no reference of getPermissionSubscriptionState method … why??

Same no reference inside index.d.ts

So, no reference in both files

Instead here

the method is present


Hmm, I can confirm - downloading the current @ionic-native release doesn’t contain the method.

Seems it was added not too long ago:

I think you should open an issue with ionic-native on Github and describe the problem. Probably a broken release somehow. (Inlcude a link to here as well and post the issue link here too)


Ohhh… the docs is for the unreleased plugin! There wasn’t a release for 16 days, the method was added after that. So somehow newer docs got released, but not the new version of the code.


Ok, many many thanks!!! I’m waiting an update of ionic native code


Any updates?
I need to use this method for a toggle enable/disable subscription.
Any ideas to make a toggle without getPermissionSubscriptionState are appreciated …