简体   繁体   English

在ionic3中推送通知?

[英]Push notifications in ionic3?

I have been trying to implement registering and receiving push notifications in my ionic3 app fro the past 2 days but nothing seems working because of the version that I am using right now. 在过去的两天内,我一直在尝试在ionic3应用程序中实现注册和接收推送通知,但是由于我现在使用的版本,似乎没有任何效果。

First of all my versions; 首先是我的版本;

rxjs : 5.5.11 rxjs:5.5.11

Angular : 5.2.11 角:5.2.11

typescript : ~2.6.2 打字稿:〜2.6.2

firebase : 5.8.2 火力:5.8.2

@angular/fire: ^5.1.1 @角度/火:^ 5.1.1

angularfire2 : ^5.1.1 angularfire2:^ 5.1.1

Things that I have tried so far: 到目前为止我尝试过的事情:

1)AngularFirestore-Firebase Native 1)AngularFirestore-Firebase本机

I am getting Object(...) is not function error with this and I realized this because of my rxjs version. 我得到的Object(...)不是函数错误,由于我的rxjs版本,我意识到了这一点。 AngularFireStore is using rxjs 6 or above. AngularFireStore使用的是rxjs 6或更高版本。 I updated rxjs to 6 but this time typescrit gave error. 我将rxjs更新为6,但是这次typecrit给出了错误。 Because rxjs was using ts 2.8 features. 因为rxjs使用的是ts 2.8功能。 I wanted update ts but ionic was not supporting it. 我想要更新ts,但是ionic不支持它。 I don't want to migrate to ionic4 becaasu I don't want to spend time for this. 我不想迁移到ionic4 becaasu,我不想为此花时间。

2)ionic-push 2)离子型推

I am getting the same Object(...) is not a function error again. 我得到相同的Object(...)再次不是函数错误。

3) FCM 3)FCM

Strange enough, I can not put FCM to the providers in the app.module.ts. 奇怪的是,我无法将FCM放在app.module.ts中的提供程序中。 Ts giving error that FCM is not suitable to be a provider. 给出错误,表明FCM不适合成为提供者。

So I need a way to implement push notifications with the package versions that I am using right now? 因此,我需要一种使用当前使用的软件包版本来实现推送通知的方法吗? Thanks in Advance! 提前致谢!

I've recently run into the same issue when trying to run AngularFire + Firebase in Ionic 3. In my case I didn't need AngularFire (often to store something in Firebase DB). 我最近在尝试在Ionic 3中运行AngularFire + Firebase时遇到了相同的问题。就我而言,我不需要AngularFire(通常将某些内容存储在Firebase DB中)。 So I just used cordova-plugin-firebase@2.0.5 with @ionic-native/firebase@^4.20.0 . 所以我只使用了cordova-plugin-firebase@2.0.5@ionic-native/firebase@^4.20.0 I'm able to build and get notifications working with Android (haven't tried iOS yet). 我能够构建并获得使用Android的通知(尚未尝试使用iOS)。

So if you just need the push notification parts, try just grabbing the Firebase plugin (and Ionic Native wrapper). 因此,如果您只需要推送通知部分,请尝试仅抓住Firebase插件(和Ionic Native包装器)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM