I am using the code from this page to get the token https://firebase.google.com/docs/cloud-messaging/android/client but i am getting an error on this specific line String msg = getString(R.string.msg_token_fmt, token);
for msg_token_fmt saying can not resolve symbol. I have done all steps in this tutorial but i get this error.
This is the code
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "Fetching FCM registration token failed", task.getException());
return;
}
// Get new FCM registration token
String token = task.getResult();
// Log and toast
String msg = getString(R.string.msg_token_fmt, token);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
What am i missing?