标签: firebase-cloud-messaging

FCM 在 iOS 上使用 Flutter 有什么要求?

我正在努力让 Firebase Cloud Messaging 通过 Flutter 与 iOS 一起使用。我已按照此处此处此处列出的步骤进行操作,但没有走运。

我没有使用模拟器,我使用的是装有 iOS 11.4.1 的 iPhone 8+。我已经在 Firebase 控制台中安装了所有三个 APN 证书。我已致电FirebaseMessaging.requestNotificationPermissions();并接受了对话。我正在通过 FCM 控制台发送消息进行测试。我的手机已通过 Firebase 进行身份验证(匿名身份验证)。

我没有在应用程序打开或关闭时收到消息。

如果有人对我可能缺少的东西有任何想法,请提供帮助。我希望能够为来到 Flutter/iOS/FCM 的其他人制作一个要点列表,让他们可以毫无错误地遵循。

ios firebase flutter firebase-cloud-messaging

1
推荐指数
1
解决办法
2447
查看次数

无法解决:firebase-messaging-15.0.0

这是我的构建 gradle(应用程序)

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'


dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-v4:26.+'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.android.support:recyclerview-v7:26.+'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-auth:9.0.2'
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
Run Code Online (Sandbox Code Playgroud)

}

在构建gradle(项目)

buildscript {
repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0'
    classpath 'com.google.gms:google-services:4.0.2'
}
}



allprojects {
repositories {
    google()
    jcenter()
    maven { url "https://maven.google.com" }
}
}
Run Code Online (Sandbox Code Playgroud)

这是错误

无法解决:firebase-messaging-15.0.0

Firebase 助手显示Dependencies 设置正确,但 Sycn 失败。请帮我。

android firebase firebase-cloud-messaging

1
推荐指数
1
解决办法
4292
查看次数

实现预定推送通知的最佳方式

我目前正在开发一个具有某种用户会议系统的应用程序,最近我们的产品团队要求包括一些预定的推送通知,提醒用户他们在 30 分钟前、10 分钟前和 10 分钟后有会议会议。(我们使用 FCM 作为推送通知服务)

目前,对于每个新会议,我们都会在 AWS CloudWatch Events 规则上注册一个 cron 作业,但我开始意识到,由于预期有大量注册会议,这可能不是实现它的最佳方式......(例如,如果我们将有 100 个活动会议,我们将有 300 个注册的 CloudWatch Events 规则...

所以我的问题是有更好的方法来实现这样的服务吗?

编辑:客户端都是 IOS(Swift) 和 Anrdoid(Java)

push-notification amazon-web-services amazon-cloudwatch firebase firebase-cloud-messaging

1
推荐指数
1
解决办法
2594
查看次数

无法解决:com.google.firebase:firebase-messaging:16.0.5

如何解决这个错误!

“无法解决:com.google.firebase:firebase-messaging:16.0.5”

Firebase 依赖版本是16.0.5,我也切换并玩了一些其他版本,仍然有错误。

  def Firebase_version = "16.0.5"
        implementation "com.google.firebase:firebase-auth:$Firebase_version"
        implementation "com.google.firebase:firebase-messaging:$Firebase_version"
Run Code Online (Sandbox Code Playgroud)

我正在使用最新版本的类路径

 classpath 'com.android.tools.build:gradle:3.2.1'
 classpath 'com.google.gms:google-services:4.0.2'
Run Code Online (Sandbox Code Playgroud)

和存储库

google()
jcenter()
Run Code Online (Sandbox Code Playgroud)

两者都添加:

安卓工作室:3.2.1

android firebase build.gradle firebase-authentication firebase-cloud-messaging

1
推荐指数
1
解决办法
9373
查看次数

使用新的 firebase API 向特定设备发送消息

我正在编写一个新的服务器应用程序(使用 .net)来向客户端(主要是 android 设备)发送通知,并且我正在使用来自 firebase 云消息传递的新 Http v1 api,我看到以下 Post 请求正文来发送主题通知

{
  "message": {
    "topic": "news",
    "notification": {
      "title": "Breaking News",
      "body": "New news story available."
    },
    "data": {
      "story_id": "story_12345"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,我将如何使用 FCM Id 向特定设备发送通知?

注意:我已经使用旧 API 实现了向单个设备发送通知。

firebase firebase-cloud-messaging

1
推荐指数
1
解决办法
6788
查看次数

实际的Android推送消息字符限制?

我认为这是官方文档中的4KB 有效负载限制,我发送了超过 1000 个字符的消息,但由于通知抽屉仅显示 11 行,因此它们被截断为 300-400。实际的官方限制是多少?我知道要显示的最多字符数是多少?

android push-notification firebase firebase-cloud-messaging

1
推荐指数
1
解决办法
8021
查看次数

更新 Firebase 软件包后,“InstanceID”不包含“SetApnsToken”的定义

在我的 Xamarin.iOS 项目中,我更新了 Firebase nuget 包,完成更新后我开始收到此代码的错误

//You'll need this method if you set "FirebaseAppDelegateProxyEnabled": NO in GoogleService-Info.plist
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
    SISConst.PushInfo = new PushNotification();
    SISConst.PushInfo.DeviceID = deviceToken.ToString();
    NSUserDefaults.StandardUserDefaults.SetString(deviceToken.ToString(),"dToken");

#if DEBUG
    Firebase.InstanceID.InstanceId.SharedInstance.SetApnsToken(deviceToken, Firebase.InstanceID.ApnsTokenType.Sandbox);
#if RELEASE
    Firebase.InstanceID.InstanceId.SharedInstance.SetApnsToken(deviceToken, Firebase.InstanceID.ApnsTokenType.Prod);
}
Run Code Online (Sandbox Code Playgroud)

下面的行显示错误

Firebase.InstanceID.InstanceId.SharedInstance.SetApnsToken(deviceToken, Firebase.InstanceID.ApnsTokenType.Sandbox);
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅屏幕截图

在此处输入图片说明

我该如何解决这个问题?

xamarin.ios ios firebase xamarin firebase-cloud-messaging

1
推荐指数
1
解决办法
795
查看次数

如何使用 FCM 和 Flutter(一个到另一个设备)发送推送通知?

我已经在 flutter 中开发了一对一聊天系统,并希望使用 FCM 向另一台设备发送推送通知。

我已经设置了所有 flutter 和 firebase 消息传递要求。

//In InitState()
_firebaseMessaging.onTokenRefresh.listen(sendTokenToServer);
    _firebaseMessaging.getToken();
    _firebaseMessaging.configure(onLaunch: (Map<String, dynamic> msg) {
      print("onLaunch");
      Navigator.push(
        context,
        MaterialPageRoute(builder: (context) => Message(this.user, this.event)),
      );
    }, onResume: (Map<String, dynamic> msg) {
      print("onResume");
      Navigator.push(
        context,
        MaterialPageRoute(builder: (context) => Message(this.user, this.event)),
      );
    }, onMessage: (Map<String, dynamic> msg) {
      print("onMessage");
    });
    _firebaseMessaging.requestNotificationPermissions(
        const IosNotificationSettings(sound: true, alert: true, badge: true));
    _firebaseMessaging.onIosSettingsRegistered
        .listen((IosNotificationSettings setting) {
      print("IOS");
    });

//sendTokenToServer() - function send FCM token my Postgres DB

//When user clicks on send Button …
Run Code Online (Sandbox Code Playgroud)

firebase flutter firebase-cloud-messaging

1
推荐指数
1
解决办法
4172
查看次数

如果我运行自己的推送通知服务器,我还需要 FCM 吗?

我刚刚阅读了很多关于推送通知服务器、自托管服务器以及云的文章。我对某一方面感到非常困惑。

我需要为使用同一应用程序的超过一百万台设备推送我的 Android/iOS 应用程序通知。现在没有这种规模的免费服务,付费服务会导致太多的月费,所以我考虑使用开源解决方案运行我自己的服务器。我已经检查了 Many 但parse似乎是最合适的。但他们说它使用 FCM,我从谷歌定价知道它只对有限数量的注册设备免费。我认为托管我自己的推送服务器可以免除这些费用;但似乎不是;那有什么好处呢?直接使用FCM不是更好吗?

push-notification apple-push-notifications android-notifications server firebase-cloud-messaging

1
推荐指数
1
解决办法
4126
查看次数

FCM 令牌不调用 didReceiveRegistrationToken

您好,FCM在我的应用程序中使用。

当我尝试读取FCM令牌时,即使编译器不调用此委托方法也是任何方式请帮助。

当我休息并检查此方法时,请不要调用我使用 ios11 swift4

extension AppDelegate: MessagingDelegate{

    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
        print("Firebase registration token: \(fcmToken)")

        let dataDict:[String: String] = ["token": fcmToken]
        NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
        // TODO: If necessary send token to application server.
        // Note: This callback is fired at each app startup and whenever a new token is generated.
    }

    func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
        print("Message data:", remoteMessage.appData)
    }  
}
Run Code Online (Sandbox Code Playgroud)

push-notification ios firebase swift firebase-cloud-messaging

1
推荐指数
1
解决办法
2909
查看次数