diff --git a/vending-app/src/main/java/com/android/vending/licensing/LicenseChecker.kt b/vending-app/src/main/java/com/android/vending/licensing/LicenseChecker.kt index c7760062af..deed9e1d84 100644 --- a/vending-app/src/main/java/com/android/vending/licensing/LicenseChecker.kt +++ b/vending-app/src/main/java/com/android/vending/licensing/LicenseChecker.kt @@ -155,7 +155,7 @@ suspend fun HttpClient.makeLicenseV2Request( url = "https://play-fe.googleapis.com/fdfe/apps/checkLicenseServerFallback?pkgn=$packageName&vc=$versionCode", headers = buildRequestHeaders(auth, androidId), adapter = GoogleApiResponse.ADAPTER -).payload?.licenseV2Response?.license?.jwt?.let { - // Field present ←→ user has license +).payload?.licenseV2Response?.license?.jwt?.takeIf { it.isNotEmpty() }?.let { + // Field present and non-empty ←→ user has license V2Response(LICENSED, it) } \ No newline at end of file diff --git a/vending-app/src/main/java/com/android/vending/licensing/LicensingService.kt b/vending-app/src/main/java/com/android/vending/licensing/LicensingService.kt index 7942d5eac2..fa4c4707a7 100644 --- a/vending-app/src/main/java/com/android/vending/licensing/LicensingService.kt +++ b/vending-app/src/main/java/com/android/vending/licensing/LicensingService.kt @@ -75,6 +75,7 @@ class LicensingService : Service() { */ if (response?.result == LICENSED && response is V2Response) { val bundle = Bundle() + Log.e(TAG, "checkLicenseV2 jwt: ${response.jwt}") bundle.putString(KEY_V2_RESULT_JWT, response.jwt) try { @@ -143,6 +144,7 @@ class LicensingService : Service() { // Attempt to acquire license if app is free ("auto-purchase") if (isLicensingPurchaseFreeAppsEnabled(this@LicensingService)) { + Log.d(TAG, "Attempting to acquire license for free app $packageName") val firstAccount = accounts[0] if (httpClient.acquireFreeAppLicense( this@LicensingService,