I try of update my app, but i show me error when the appa should be generated the token. my app show me token not generated.
my firebase code is the follow:
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseIIDService";
@Override
public void onTokenRefresh() {
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
storeToken(refreshedToken);
}
private void storeToken(String token) {
//saving the token on shared preferences
SharedPreference.getInstance(getApplicationContext()).saveDeviceToken(token);
}
}
I rencently migrated to AndroidX, and i dont know what happpen with my code thnks
i try with this, but not work, token i not generated
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.messaging.FirebaseMessagingService;
public class MyFirebaseInstanceIDService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseIIDService";
@Override
public void onNewToken(String token) {
super.onNewToken(token);
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
storeToken(refreshedToken);
}
private void storeToken(String token) {
//saving the token on shared preferences
SharedPreference.getInstance(getApplicationContext()).saveDeviceToken(token);
}
}