android – Getting E/FirebaseInstanceId: Token retrieval failed: INVALID_SENDER-ThrowExceptions

Exception or error:

I can up my data to Firebase cloud store, but every time I want to retrieve data from document it encounter some problems.

There is my code below.

private FirebaseFirestore db = FirebaseFirestore.getInstance();
private CollectionReference memRef = db.collection("Member");
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    nameinput = findViewById(R.id.name);
    passwordinput = findViewById(R.id.password);
    phoneinput = findViewById(R.id.phone);
    getinfo = findViewById(R.id.getinfo);
}


public void insertAccount(View v){
    String name = nameinput.getText().toString();
    String password = passwordinput.getText().toString();
    String phone = phoneinput.getText().toString();
    Member account = new Member(name,password,phone);
    memRef.add(account);
}
public void getAccount(View v){
    memRef.get()
            .addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
                @Override
                public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
                    String date = "";
                    for (QueryDocumentSnapshot documentSnapshot : queryDocumentSnapshots){
                        Member mem = documentSnapshot.toObject(Member.class);
                        String name = mem.getName();
                        String password = mem.getPassword();
                        String phone = mem.getPhone();
                        date += "name:" + name + "\npassword:" + password + "\nphone:" + phone + "\n\n" ;
                    }
                    getinfo.setText(date);
                }
            });
}

My logcat shows.

2020-02-23 15:04:29.457 3154-3154/? E/FirebaseInstanceId: Failed to
start service while in background: java.lang.IllegalStateException:
Not allowed to start service Intent {
act=com.google.firebase.INSTANCE_ID_EVENT
pkg=com.google.android.apps.messaging
cmp=com.google.android.apps.messaging/.fcm.BugleFirebaseInstanceIDService (has extras) }: app is in background uid UidRecord{3a2e8c3 u0a84 RCVR
idle change:uncached procs:1 seq(0,0,0)} 2020-02-23 15:04:31.465
3314-3314/? E/FirebaseInstanceId: Failed to start service while in
background: java.lang.IllegalStateException: Not allowed to start
service Intent { act=com.google.firebase.INSTANCE_ID_EVENT
pkg=com.google.android.gm
cmp=com.google.android.gm/com.google.firebase.iid.FirebaseInstanceIdService
(has extras) }: app is in background uid UidRecord{743aaeb u0a60 RCVR
idle change:uncached procs:1 seq(0,0,0)} 2020-02-23 15:04:41.185
3723-3849/? E/FirebaseInstanceId: Token retrieval failed:
INVALID_SENDER 2020-02-23 15:05:11.301 3723-3849/?
E/FirebaseInstanceId: Token retrieval failed: INVALID_SENDER
2020-02-23 15:06:11.458 3723-3849/? E/FirebaseInstanceId: Token
retrieval failed: INVALID_SENDER 2020-02-23 15:08:11.590 3723-3849/?
E/FirebaseInstanceId: Token retrieval failed: INVALID_SENDER

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *