Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Google to refetch .well-known/assetlinks.json in order to fix my Android App Link implementation

Tags:

android

twa

I have successfully implemented Android App links with My Local APK and it works. When I published the same APK in Google Play Store I figured out that I need to change SHA 256 fingerprint in my /.well-known/assetlinks.json with the fingerprint provided by Google. So I changed it. Unfortunately it seems that Google keeps the old copy of assetlinks.json which brakes my app links.

I have checked https://developers.google.com/digital-asset-links/tools/generator and it said "No app deep linking permission found for [your-app]"

I have checked https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=[my-site]&relation=delegate_permission/common.handle_all_urls and it shows me the old version of assetlinks.json

My robots.txt

User-agent: *
Disallow:

My .htaccess file in directory /.well-known

Require all granted
RewriteEngine Off


<FilesMatch "\.(txt)$">
    Require all granted
</FilesMatch>

<FilesMatch "\.(txt)$">
    Allow from all
</FilesMatch>

My assetlinks.json

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target" : { "namespace": "android_app", "package_name": "my-app-id",
               "sha256_cert_fingerprints": ["my-sha-256-provided-by-gogole-play-console"] }
}]

The result of https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=[my-site]&relation=delegate_permission/common.handle_all_urls

{
  "statements": [
    {
      "source": {
        "web": {
          "site": "https://my-host."
        }
      },
      "relation": "delegate_permission/common.handle_all_urls",
      "target": {
        "androidApp": {
          "packageName": "my-app-id",
          "certificate": {
            "sha256Fingerprint": "the-old-sha-256-fingerprint"
          }
        }
      }
    }
  ],
  "maxAge": "534347.929731888s",
  "debugString": "********************* ERRORS *********************\nNone!\n********************* INFO MESSAGES *********************\n* Info: The following statements were considered when processing the request:\n\n---\nSource: Web asset with site https://my-host. (which is equivalent to 'https://my-host')\nRelation: delegate_permission/common.handle_all_urls\nTarget: Android app asset with package name my-app-id and certificate fingerprint the-old-sha-256 \nWhere this statement came from:\n  Origin of the statement: Web asset with site https://my-host. (which is equivalent to 'https://my-host')\n  Include directives followed (in order):\n    \u003cNone\u003e\nMatches source query: Yes\nMatches relation query: Yes\nMatches target query: Yes\n\n--- End of statement list. ---\n\n\n"
}

The the-old-sha-256 is different from the SHA 256 in my actual assetlinks.json

P.S. my-app-id, my-host, [my-site] and so on are placeholders.

So... How to force Google to read my current assetlinks.json instead of using old cached version?

like image 372
Trayan Stoyanov Avatar asked Apr 04 '19 07:04

Trayan Stoyanov


People also ask

Where is well known Assetlinks JSON?

well-known/" is the directory that sits on the root folder and contains the "assetlinks. json" file.

What is sha256_cert_fingerprints?

sha256_cert_fingerprints is the SHA256 fingerprints of your app's signing certificate. Find more details in the Android App Links documentation.


1 Answers

  1. In your case, google cached your SHA256 and will take max limit of eight days to update your SHA256. Just change the name of website in the url given below, that will show you the SHA256 key google has been cached.

https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://www.your-website-name.com&relation=delegate_permission/common.handle_all_urls


The assetlinks.json file may also be cached by Play Services on your device and also on Google’s servers, so it may take a few days for them to be updated from any changes you make to your web servers. And SmartLock chrome/app login sharing needs your APK to be downloaded from Google’s app store.

like image 53
Himanshu Gupta Avatar answered Nov 15 '22 19:11

Himanshu Gupta