英文:
Auto verify not always working in App Links using android
问题
我目前正在实现应用程序中的应用链接功能。目标是扫描 QR 码并将用户重定向到应用程序内部。然而,我遇到了一个问题,有时在安装了应用程序的 beta 版本后,成功扫描 QR 码会直接将我带到应用程序内部。但是,如果我卸载应用程序然后重新安装,功能就无法正常工作。
在我的应用程序的设置中,“打开支持的链接” 已打开,但没有显示“验证链接”。有趣的是,相同的代码间歇性地起作用。
以下是一些额外的细节:
assetlinks 文件已经位于以下位置:https://example.com/.well-known/assetlinks.json。我还使用了 Google 链接检查器,显示所有我的 SHA 代码在此位置都是活动的。
清单文件的相关部分如下:
<activity
android:name=".ui.other_common_screens.splash.view.SplashActivity"
android:exported="true"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="example.com" />
<data android:pathPrefix="/" />
</intent-filter>
</activity>
我使用的深度链接 URL 是:https://example.com/services/categories/7/service/11/da-001/donation-details/2/25
我正在经历的行为相当令人困惑。即使清除缓存并从 beta 版本中卸载应用程序后,应用链接功能有时能正常工作,有时不能,这取决于全新安装。
请指导我解决这个问题,因为我希望为我的用户使用 Deeplink 时能自动验证。
英文:
I am currently working on implementing app links functionality in my application. The goal is to scan QR codes and redirect users inside the app. However, I am encountering an issue where, sometimes, after installing a beta version of the app, scanning a QR code successfully takes me directly inside the app. But, if I uninstall the app and reinstall it again, the functionality stops working.
In the settings of my app, "Open Supported Links" is turned on, but there is no "Verified Link" displayed. Interestingly, the same code works intermittently.
Here are some additional details:
The assetlinks file is already available at the following location: https://example.com/.well-known/assetlinks.json. I have also used the Google link checker, which shows that all my SHA codes are active at this location.
The relevant section of my manifest file is as follows:
<activity
android:name=".ui.other_common_screens.splash.view.SplashActivity"
android:exported="true"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="example.com" />
<data android:pathPrefix="/" />
</intent-filter>
</activity>
The deep link URL I am using is: https://example.com/services/categories/7/service/11/da-001/donation-details/2/25
The behavior I'm experiencing is quite confusing. Even after clearing my cache and uninstalling the app from the beta version, the app links functionality sometimes works and sometimes doesn't, depending on a fresh install.
Kindly guide me to fix this issue, as I want Auto-verify for my users to use Deeplink.
答案1
得分: 0
经过彻底的调查,我确定并修复了问题。这与我的自动验证功能或代码无关,而与我们服务器的负载均衡器有关。assetLinks.json文件只在一个服务器实例上可用,导致在Google访问时出现间歇性的404错误。我想分享这一发现,以帮助可能面临类似挑战的其他人。
英文:
After thorough investigation, I identified and fixed the issue. It wasn't related to my Auto Verify feature or code, but rather to our server's Load Balancer. The assetLinks.json file was only available on one server instance, causing intermittent 404 errors when accessed by Google. I wanted to share this finding to potentially help others facing similar challenges.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论