|
| 1 | +Firebase Cloud Messaging Java Quickstart |
| 2 | +======================================== |
| 3 | + |
| 4 | +The Firebase Cloud Messaging Java quickstart app demonstrates sending |
| 5 | +notification-messages to a topic. All clients subscribed to the topic |
| 6 | +will receive the message. |
| 7 | + |
| 8 | +Introduction |
| 9 | +------------ |
| 10 | + |
| 11 | +This is a simple example of using Firebase Cloud Messaging REST API to send |
| 12 | +the same message to different platforms. To learn more about how you can use |
| 13 | +Firebase Cloud Messaging REST API in your app, see [About Cloud Messaging Server](https://firebase.google.com/docs/cloud-messaging/server/). |
| 14 | + |
| 15 | +Getting started |
| 16 | +--------------- |
| 17 | + |
| 18 | +1. [Add Firebase to your Android Project](https://firebase.google.com/docs/android/setup). |
| 19 | +2. Create a service account as described in [Adding Firebase to your Server](https://firebase.google.com/docs/admin/setup) and download the JSON file. |
| 20 | + - Copy the json file to this folder and rename it to `service-account.json`. |
| 21 | +3. Change the `PROJECT_ID` variable in `Messenger.java` to your project ID. |
| 22 | + |
| 23 | +Run |
| 24 | +--- |
| 25 | +- From the `messaging` directory run `./gradlew build run` to run the quickstart. |
| 26 | +- Any client devices that you have subscribed to the news topic should receive |
| 27 | + a notification. |
| 28 | + |
| 29 | +Best practices |
| 30 | +-------------- |
| 31 | +This section provides some additional information about how the FCM payloads can |
| 32 | +be used to target different platforms. |
| 33 | + |
| 34 | +### Common payloads ### |
| 35 | + |
| 36 | +In many cases you may want to send the same message to multiple platforms. If |
| 37 | +this is a notification-message (display notification) then you can use the |
| 38 | +common payloads. These are payloads that are automatically translated to their |
| 39 | +platform equivalent payloads. |
| 40 | + |
| 41 | +Support |
| 42 | +------- |
| 43 | + |
| 44 | +- [Stack Overflow](https://stackoverflow.com/questions/tagged/firebase-cloud-messaging) |
| 45 | +- [Firebase Support](https://firebase.google.com/support/) |
| 46 | + |
| 47 | +License |
| 48 | +------- |
| 49 | + |
| 50 | +Copyright 2016 Google, Inc. |
| 51 | + |
| 52 | +Licensed to the Apache Software Foundation (ASF) under one or more contributor |
| 53 | +license agreements. See the NOTICE file distributed with this work for |
| 54 | +additional information regarding copyright ownership. The ASF licenses this |
| 55 | +file to you under the Apache License, Version 2.0 (the "License"); you may not |
| 56 | +use this file except in compliance with the License. You may obtain a copy of |
| 57 | +the License at |
| 58 | + |
| 59 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 60 | + |
| 61 | +Unless required by applicable law or agreed to in writing, software |
| 62 | +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 63 | +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 64 | +License for the specific language governing permissions and limitations under |
| 65 | +the License. |
0 commit comments