How to get device tokens (FCM registration tokens) from Firebase?
I am making a mobile application using firebase and its server using node.js.
I want to send a message push notificationfrom the server, but I do not know how to get the device token.
push notification
How to get device tokens from an external server? Now I am using the Firebase admin SDK.
Is the device token only generated when the application connects to the fcm server?
Do I have to save the token to another database when I first run the application and register the FCM server?
1. ? SDK Firebase admin.
API . () , .
2. FCM?
(. )
FCM SDK .
FCM. FirebaseInstanceID ( SDK), , , .
3. , FCM-?
# 1, , , .
, ,
public class MyAndroidFirebaseInstanceIdService extends FirebaseInstanceIdService { private static final String TAG = "MyAndroidFCMIIDService"; @Override public void onTokenRefresh() { //Get hold of the registration token String refreshedToken = FirebaseInstanceId.getInstance().getToken(); //Log the token Log.d(TAG, "Refreshed token: " + refreshedToken); } private void sendRegistrationToServer(String token) { //Implement this method if you want to store the token on your server } }
. Tutorial
Source: https://habr.com/ru/post/1673372/More articles:Can I enlarge the window area to resize the window with the mouse? - c #Custom Wpf window, Windows window resizing function - c #golang (* interface {}) (nil) равен нулю или нет? - goGet MAX and MIN in SQL string - sqlAdd new colors along with custom theme colors angular2 - angularAngular 2 fakeAsync expects timeout in function with tick ()? - javascriptCustom URI schemes are not allowed for type "Web" - Google with Firebase - ios"Installing yarn" causes "network connectivity problems" - ruby-on-rails-4An advanced PWA web application, caching index.php is possible - cachingИзвлечь объект из изображения коробки с объектом - pythonAll Articles