Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Under what situation I should concern about "Prevent auto initialization" if I were using Firebase Messaging

Currently, I'm using only 1 Firebase product - Firebase Messaging. (I didn't use Firebase Analytics)

implementation 'com.google.firebase:firebase-messaging:18.0.0'

According to https://firebase.google.com/docs/cloud-messaging/android/client#prevent-auto-init

Firebase generates an Instance ID, which FCM uses to generate a registration token and Analytics uses for data collection. When an Instance ID is generated, the library will upload the identifier and configuration data to Firebase. If you prefer to prevent Instance ID autogeneration, disable auto initialization for FCM and Analytics (you must disable both) by adding these metadata values to your AndroidManifest.xml:

I don't really understand the above.

My only use cases are

  • Calling FirebaseInstanceId.getInstance().getInstanceId()
  • Receiving push notification in MyFirebaseMessagingService extends FirebaseMessagingService

I'm concerning, under what kind of situation, I should care about "Prevent auto initialization", and what's wrong with "auto initialization"?

like image 480
Cheok Yan Cheng Avatar asked Oct 22 '25 14:10

Cheok Yan Cheng


1 Answers

As the message says, you would want to prevent auto initialization when you don't want the Firebase SDK to automatically upload the instance ID token as soon as it becomes available. This might be a concern for you if you're not allowed to track the usage of the device for whatever reason. This might impact the ability of some Firebase products to work correctly. If this isn't a concern to you, then you don't have to make any changes.

like image 183
Doug Stevenson Avatar answered Oct 25 '25 13:10

Doug Stevenson