3

I have no clue what I am doing wrong, the following code works well

FirebaseInstanceId.getInstance().getToken("12", "FCM");
FirebaseInstanceId.getInstance().getToken("11", "FCM");

but another one

FirebaseInstanceId.getInstance().getToken("8", "FCM")

throws an IOException about INVALID_SENDER

All from stack trace

W/System.err: java.io.IOException: INVALID_SENDER
        at com.google.firebase.iid.zzo.zza(Unknown Source)
        at com.google.firebase.iid.zzo.zza(Unknown Source)
        at com.google.firebase.iid.zzr.then(Unknown Source)
        at com.google.android.gms.tasks.zzd.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)

The code itself runs in Runnable Thread instance

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Bartłomiej Sobieszek
  • 2,692
  • 2
  • 25
  • 40
  • [Sender ID](https://firebase.google.com/docs/cloud-messaging/concept-options#credentials) should be the value shown in the Cloud Messaging tab of your project setting. – Bob Snyder Jun 05 '18 at 14:37
  • I already know it (read it somewhere on SO), but that does not make it clear why I can use sender IDs other than mine. – Bartłomiej Sobieszek Jun 06 '18 at 06:05
  • Could you post the actual source code? Are all these lines in one handler/runnable thread? Or is the 3rd one called later on in your app? – AL. Jun 06 '18 at 14:53
  • 2
    There are cases when a single app would want to register with multiple senders for notifications. Think a news app with multiple sources, each source has their own sender ID allowing the app to register for notifications from each source. – Arthur Thompson Jun 06 '18 at 15:34
  • Arthur actually answered my question, but I can't close the question as it's formed as a comment. – Bartłomiej Sobieszek Jun 07 '18 at 07:04

1 Answers1

1

This means exactly what it says: Invalid Sender ID. You should obtain your SENDER_ID from FCM Developers project console in the "Cloud Messaging" tab. This intended to obtain registration tokens within one project for several registered apps.

enter image description here

Evgeniy Mishustin
  • 3,343
  • 3
  • 42
  • 81