Люди добрые, помогите уже всё перерыл в интернете.
Не импортируется библиотека:
import com.google.firebase.iid.FirebaseInstanceId;
Вылезает ошибка Gradle Build.
import com.google.firebase.iid.FirebaseInstanceId;
^
symbol: class FirebaseInstanceId
location: package com.google.firebase.iid
Код программы:
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
firebaseAuth.signInWithCredential(credential).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(data -> {
String token = data.getResult().getToken();
UserModel userModel = new UserModel("", "", "", firebaseAuth.getCurrentUser().getPhoneNumber(),
firebaseAuth.getUid(), "online", "false",token);
databaseReference.child(firebaseAuth.getUid()).setValue(userModel).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
getFragmentManager().beginTransaction().replace(R.id.container, new UserData()).commit();
binding.progressLayout.setVisibility(View.GONE);
binding.progressBar.stop();
} else
Toast.makeText(getContext(), "" + task.getException(), Toast.LENGTH_SHORT).show();
}
});
});
} else
Toast.makeText(getContext(), "" + task.getResult(), Toast.LENGTH_SHORT).show();
}
});
}