ORIGINAL EXCEPTION: No provider for Push: ionic 2 push


#1

I followed the tut on implementing push notification religiously but got white screen with the following errors:
EXCEPTION: Error in ./MyApp class MyApp_Host - inline template:0:0 caused by: No provider for Push! and
ORIGINAL EXCEPTION: No provider for Push!
The errors are from my browser error console when I did: $ionic serve.
My ionic info is:
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X Yosemite
Node Version: v6.7.0
Xcode version: Xcode 7.2.1
Build version 7C1002
Pls. thanks for your anticipated help.


#2

Hi there, have the same issue here… could u fix it?


#3

@mariomol I’ve not yet found solution to the problem. I’m wondering if you already found a solution.


#4

I cant remember to be honest… what i can say is how i’m making this now. So in app.component.ts i made:

import { Push } from 'ionic-native';

In the constructor:

let push = Push.init({ android: { senderID: 'XX' }, ios: { alert: 'true', badge: true, sound: 'false' }, windows: {} });

Then :

push.on('notification', (data) => { })


#5

I’m not sure that is the right way to go about it. You have to add CloudModule.forRoot(cloudSettings) inside the imports: [ ] in app.module.ts.


#6

Did you get to fix this error @okeckukwu


#7

HI! Could you share your code worked ?

Thanks and regards,


#8

how you solved this
ORIGINAL EXCEPTION: No provider for Push: ionic 2 push


#9

I wrote a push notification tutorial, may be it can help https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59


#10

Thanks @ankushagg93. It works


#11

Hello, i use your push notifications code, but not see the token when test it, may you help me ? I am a beginner


#12

Adding Push under providers in app.module.ts solved my issue.
eg: providers:[
Push
]
Note: import { Push, PushObject, PushOptions } from ‘@ionic-native/push’; in header.


#13

Thanks, this solved my issue.