I'm implementing Play integrity into my app. The debug app is not listed on the Playstore and it has a different packagename than the release one. So I understand that for using the Google Play Integrity API I should pass the cloudProjectNumber
as part of the IntegrityTokenRequest
as the documentation says (https://developer.android.com/google/play/integrity/verdict#request) Example:
val nonceBase64 = //nonce
val integrityManager = IntegrityManagerFactory.create(context)
val cloudProjectNumber = //cloud Project number from console.cloud.google.com
val tokenRequest = IntegrityTokenRequest.builder()
.setCloudProjectNumber(cloudProjectNumber)
.setNonce(nonceBase64)
.build()
val task = integrityManager.requestIntegrityToken(tokenRequest)
This is the error I see on the logs:
[6668] qyo.a(1): requestIntegrityToken() failed for ${packageName}.com.google.android.finsky.integrityservice.IntegrityException
...
Caused by: DisplayErrorMessage[Error retrieving information from server. DF-DFERH-01]
com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.play.core.integrity.IntegrityServiceException: -1: Integrity API error (-1): Integrity API is not available.
Integrity API is not enabled, or the Play Store version might be old.
Recommended actions:
1) Make sure that Integrity API is enabled in Google Play Console.
2) Ask the user to update Play Store.
(https://developer.android.com/google/play/integrity/reference/com/google/android/play/core/integrity/model/IntegrityErrorCode.html#API_NOT_AVAILABLE).
at com.google.android.gms.tasks.zzw.getResult(com.google.android.gms:play-services-tasks@@18.0.2:3)
at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.0.2:1)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: com.google.android.play.core.integrity.IntegrityServiceException: -1: Integrity API error (-1): Integrity API is not available.
Integrity API is not enabled, or the Play Store version might be old.
Recommended actions:
1) Make sure that Integrity API is enabled in Google Play Console.
2) Ask the user to update Play Store.
(https://developer.android.com/google/play/integrity/reference/com/google/android/play/core/integrity/model/IntegrityErrorCode.html#API_NOT_AVAILABLE).
at com.google.android.play.core.integrity.s.b(com.google.android.play:integrity@@1.1.0:5)
at com.google.android.play.integrity.internal.i.a(com.google.android.play:integrity@@1.1.0:3)
at com.google.android.play.integrity.internal.b.onTransact(com.google.android.play:integrity@@1.1.0:3)
at android.os.Binder.execTransactInternal(Binder.java:1321)
at android.os.Binder.execTransact(Binder.java:1280)
Additional Information:
- The Release app is not having the same error as the debug one (because it is listed on playstore I think)
- The debug app is also integrated with Firebase and its
project_number
from thegoogle-services.json
file matches the one on console.cloud.google.com - I checked the the Google Play Integrity is enabled for the corresponding cloud Project
I tried enable-disable The API on console.cloud.google.com but it did not work. Also tried to add the SHA1 from by debug keystore but that doesn't seem to do something (because on release the issue is not happening)
I believe that the issue is that the IntegrityManager
is somehow not taking the cloudProjectNumber
Any help is really appreciated!