LoginSignup
4
4

More than 5 years have passed since last update.

Firebase Notificationは開発者ではなくマーケターが使うもの

Last updated at Posted at 2016-08-25

ほぼ自分用のメモ。

すでに多くの記事が書いているが、Firebase Notificationは、基本的に開発者が使うものではない。

Firebaseコンソール(https://console.firebase.google.com/project/プロジェクト名/notification) からポチポチやるのがFirebase Notificationと思っていたけど、そうではなくて、

こういうのもFirebase Notification

{
   "to": "APA9・・・WhfB",
   "priority": "high",
   "sound": "default",
   "time_to_live": 3600,
   "collapse_key": "new_message",
   "notification": {
      "title": "test4",
      "body": "0:37です!",
      "icon": "ic_notification"
   },
   "data": {
      "url": "https://crowdworks.jp/xx/yy/5"
   }
}

Notificationじゃないのはどんなの?っていうと、そもそも以下のように notification キーがないもの。

{
   "to": "APA9・・・WhfB",
   "priority": "high",
   "sound": "default",
   "time_to_live": 3600,
   "collapse_key": "new_message",
   "data": {
      "url": "https://crowdworks.jp/xx/yy/5"
   }
}

Firebase Notificationが「マーケターがつかうもの」な理由

  • アプリがちゃんと実装をしないかぎり「バックグラウンドでしかプッシュ通知を受信・表示しない」ということ
  • Firebase Notificationがバックグラウンドで出した通知を、アプリがフォアグラウンドで上書きしたりキャンセルしたりできないこと

とくに後者が決定的。
Androidは「通知をまとめる」のが推奨されているのだから、複数プッシュしてまとめられないような通知はおそらく開発者が使うべきではない。

Notification Messaging
プッシュを受ける主体 Google Playサービス? アプリ
プッシュを受けたら 通知パネルに通知が出る? 無条件に出る 出ない
通知をまとめる できない アプリ次第
BigText/BigPictureスタイル のプッシュ通知 できない アプリ次第
collapse_key

まとめ

  • 新着メッセージ通知など、機能を実装するのはFirebase Cloud Messagingをつかおう
  • 機能実装に関係のないプッシュを送りつけるには、Firebase Notificationを使って、アプリをまさに使ってくれてるユーザの邪魔をしないようにしよう
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4