Ionic 2 Native OneSignal not found in the ionic-native node_module folder

Good day, please I am having problem implementing the ionic 2 OneSignal push notification plugin into my project, after running $ ionic plugin add onesignal-cordova-plugin, the plugin is added to the plugins folder but when i try to import it into typescript using (import { OneSignal } from ‘ionic-native’:wink: it will be showing an error message (TS2305: Module ‘“W:/MobileApps/ElizadeApp/node_modules/ionic-native/dist/index”’ has no exported member ‘OneSignal’.) then i checked the folder it is pointing and couldn’t find anything relating to OneSignal. Here is the documentation . Please help

Can you make sure you have the most recent version of ionic-native. While the docs get auto added, it doesn’t mean that the current version is released to npm.

So pls tell me how to download it without npm…

Whats the version in your package.json? It should be included in ionic-native 1.3.9

“ionic-native”: “1.2.4”,

Bump that version in your package.json to 1.3.9, then run npm install

1 Like

Thank you so much…

Please I have another problem with the one signal. I have included this code to my app.ts file under the platform.ready block (let notificationOpenedCallback(jsonData: any) {
console.log('didReceiveRemoteNotificationCallBack: ’ + JSON.stringify(jsonData));

{googleProjectNumber: ‘703322744261’},

OneSignal.enableInAppAlertNotification(true):wink: and also imported it (import { OneSignal } from ‘ionic-native’:wink:

but this line seems to be showing error (OneSignal.init(‘b2f7f966-d8cc-11e4-bed1-df8f05be55ba’,
{googleProjectNumber: ‘703322744261’},

the error message reads: TypeScript error: app/app.ts(70,7): Error TS2346: Supplied parameters do not match any signature of call target.

Please check the attached image for the error.


Hey! I’ve found an issue in ionic-native

this line is missing

export * from './plugins/onesignal';

importing OneSignal works fine after that using Typescript

Replace the init definition with the following to onesignal.d.ts

    static init(appId: string, options: {
        googleProjectNumber: string;
        autoRegister?: boolean;
    }, notificationCallback: any): Promise<any>;

This should fix the signature error for now

Thanks for your response but i was able able to fix the error by using window[‘OneSignal’].init(myConfigs.googleServerAPI,
{googleProjectNumber: myConfigs.googleSenderIDOrProjectNumber},