I am trying to implement firebase app check
in my android app using Play-Integrity API
. I have added both my SHA-1 & SHA-256 fingerprints in my firebase app (acquired from Google play console
and Android studio gradle signing report
both) into my firebase app.
I have added this code inside all my activities in my app, before using any other Firebase SDKs
:
@Override
protected void onCreate(Bundle savedInstanceState) {
FirebaseApp.initializeApp(this);
FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
firebaseAppCheck.installAppCheckProviderFactory(PlayIntegrityAppCheckProviderFactory.getInstance());
}
Now no matter how many times I run my app, I keep getting the error in my console:
pc_0 - Detected invalid AppCheck token. Reconnecting (2 attempts remaining)
pc_0 - Detected invalid AppCheck token. Reconnecting (1 attempts remaining)
pc_0 - Detected invalid AppCheck token. Reconnecting (0 attempts remaining)
pc_0 - Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Invalid appcheck token
I have followed all the steps exactly as mentioned in this page. My app is already uploaded in Google play store, and Google Play Integrity API is already enabled in Google cloud console
. What more do I need to do? Please help me.
if you are under debug mode you should add debug token to your appcheck :
Appcheck -- > Application -- > Manage debug token
add this line to your gradle :
And then instantiate your appcheck this way :
After that , lunch your application , in your logcat , look for this :
So you need to add this token
123a4567-b89c-12d3-e456-789012345678
in your Appcheck debug token .this should work for you !